亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? besttree.c

?? 數(shù)據(jù)挖掘c4.5算法(vc語言版本)歡迎大家下載測試!!!!
?? C
字號:
/*************************************************************************/
/*									 */
/*	Routines to manage tree growth, pruning and evaluation		 */
/*	------------------------------------------------------		 */
/*									 */
/*************************************************************************/


#include "defns.i"
#include "types.i"
#include "extern.i"


ItemNo		*TargetClassFreq;
Tree		*Raw;
extern Tree	*Pruned;



/*************************************************************************/
/*									 */
/*	Grow and prune a single tree from all data			 */
/*									 */
/*************************************************************************/


    OneTree()
/*  ---------  */
{
    Tree FormTree(), CopyTree();
    Boolean Prune();

    InitialiseTreeData();
    InitialiseWeights();

    Raw = (Tree *) calloc(1, sizeof(Tree));
    Pruned = (Tree *) calloc(1, sizeof(Tree));

    AllKnown = true;
    Raw[0] = FormTree(0, MaxItem);
    printf("\n");
    PrintTree(Raw[0]);

    SaveTree(Raw[0], ".unpruned");

    Pruned[0] = CopyTree(Raw[0]);
    if ( Prune(Pruned[0]) )
    {
	printf("\nSimplified ");
	PrintTree(Pruned[0]);
    }
}



/*************************************************************************/
/*									 */
/*	Grow and prune TRIALS trees and select the best of them		 */
/*									 */
/*************************************************************************/


short BestTree()
/*    --------  */
{
    Tree CopyTree(), Iterate();
    Boolean Prune();
    short t, Best=0;

    InitialiseTreeData();

    TargetClassFreq = (ItemNo *) calloc(MaxClass+1, sizeof(ItemNo));

    Raw    = (Tree *) calloc(TRIALS, sizeof(Tree));
    Pruned = (Tree *) calloc(TRIALS, sizeof(Tree));

    /*  If necessary, set initial size of window to 20% (or twice
	the sqrt, if this is larger) of the number of data items,
	and the maximum number of items that can be added to the
	window at each iteration to 20% of the initial window size  */

    if ( ! WINDOW )
    {
	WINDOW = Max(2 * sqrt(MaxItem+1.0), (MaxItem+1) / 5);
    }

    if ( ! INCREMENT )
    {
	INCREMENT = Max(WINDOW / 5, 1);
    }

    FormTarget(WINDOW);

    /*  Form set of trees by iteration and prune  */

    ForEach(t, 0, TRIALS-1 )
    {
        FormInitialWindow();

	printf("\n--------\nTrial %d\n--------\n\n", t);

	Raw[t] = Iterate(WINDOW, INCREMENT);
	printf("\n");
	PrintTree(Raw[t]);

	SaveTree(Raw[t], ".unpruned");

	Pruned[t] = CopyTree(Raw[t]);
	if ( Prune(Pruned[t]) )
	{
	    printf("\nSimplified ");
	    PrintTree(Pruned[t]);
	}

	if ( Pruned[t]->Errors < Pruned[Best]->Errors )
	{
	    Best = t;
	}
    }
    printf("\n--------\n");

    return Best;
}



/*************************************************************************/
/*									 */
/*  The windowing approach seems to work best when the class		 */
/*  distribution of the initial window is as close to uniform as	 */
/*  possible.  FormTarget generates this initial target distribution,	 */
/*  setting up a TargetClassFreq value for each class.			 */
/*									 */
/*************************************************************************/


    FormTarget(Size)
/*  -----------  */
    ItemNo Size;
{
    ItemNo i, *ClassFreq;
    ClassNo c, Smallest, ClassesLeft=0;

    ClassFreq = (ItemNo *) calloc(MaxClass+1, sizeof(ItemNo));

    /*  Generate the class frequency distribution  */

    ForEach(i, 0, MaxItem)
    {
	ClassFreq[ Class(Item[i]) ]++;
    }

    /*  Calculate the no. of classes of which there are items  */

    ForEach(c, 0, MaxClass)
    {
	if ( ClassFreq[c] )
	{
	    ClassesLeft++;
	}
	else
	{
	    TargetClassFreq[c] = 0;
	}
    }

    while ( ClassesLeft )
    {
	/*  Find least common class of which there are some items  */

	Smallest = -1;
	ForEach(c, 0, MaxClass)
	{
	    if ( ClassFreq[c] &&
		 ( Smallest < 0 || ClassFreq[c] < ClassFreq[Smallest] ) )
	    {
		Smallest = c;
	    }
	}

	/*  Allocate the no. of items of this class to use in the window  */

	TargetClassFreq[Smallest] = Min(ClassFreq[Smallest], Round(Size/ClassesLeft));

	ClassFreq[Smallest] = 0;

	Size -= TargetClassFreq[Smallest];
	ClassesLeft--;
    }

    free(ClassFreq);
}



/*************************************************************************/
/*									 */
/*  Form initial window, attempting to obtain the target class profile	 */
/*  in TargetClassFreq.  This is done by placing the targeted number     */
/*  of items of each class at the beginning of the set of data items.	 */
/*									 */
/*************************************************************************/


    FormInitialWindow()
/*  -------------------  */
{
    ItemNo i, Start=0, More;
    ClassNo c;
    void Swap();

    Shuffle();

    ForEach(c, 0, MaxClass)
    {
	More = TargetClassFreq[c];

	for ( i = Start ; More ; i++ )
	{
	    if ( Class(Item[i]) == c )
	    {
		Swap(Start, i);
		Start++;
		More--;
	    }
	}
    }
}



/*************************************************************************/
/*									 */
/*		Shuffle the data items randomly				 */
/*									 */
/*************************************************************************/


    Shuffle()
/*  -------  */
{
    ItemNo This, Alt, Left;
    Description Hold;

    This = 0;
    for( Left = MaxItem+1 ; Left ; )
    {
        Alt = This + (Left--) * Random;
        Hold = Item[This];
        Item[This++] = Item[Alt];
        Item[Alt] = Hold;
    }
}



/*************************************************************************/
/*									 */
/*  Grow a tree iteratively with initial window size Window and		 */
/*  initial window increment IncExceptions.				 */
/*									 */
/*  Construct a classifier tree using the data items in the		 */
/*  window, then test for the successful classification of other	 */
/*  data items by this tree.  If there are misclassified items,		 */
/*  put them immediately after the items in the window, increase	 */
/*  the size of the window and build another classifier tree, and	 */
/*  so on until we have a tree which successfully classifies all	 */
/*  of the test items or no improvement is apparent.			 */
/*									 */
/*  On completion, return the tree which produced the least errors.	 */
/*									 */
/*************************************************************************/


Tree Iterate(Window, IncExceptions)
/*   -------  */
    ItemNo Window, IncExceptions;
{
    Tree Classifier, BestClassifier=Nil, FormTree();
    ItemNo i, Errors, TotalErrors, BestTotalErrors=MaxItem+1,
	   Exceptions, Additions;
    ClassNo Assigned, Category();
    short Cycle=0;
    void Swap();

    printf("Cycle   Tree    -----Cases----");
    printf("    -----------------Errors-----------------\n");
    printf("        size    window   other");
    printf("    window  rate   other  rate   total  rate\n");
    printf("-----   ----    ------  ------");
    printf("    ------  ----  ------  ----  ------  ----\n");

    do
    {
	/*  Build a classifier tree with the first Window items  */

	InitialiseWeights();
	AllKnown = true;
	Classifier = FormTree(0, Window-1);

	/*  Error analysis  */

	Errors = Round(Classifier->Errors);

	/*  Move all items that are incorrectly classified by the
	    classifier tree to immediately after the items in the
	    current window.  */

	Exceptions = Window;
	ForEach(i, Window, MaxItem)
	{
	    Assigned = Category(Item[i], Classifier);
	    if ( Assigned != Class(Item[i]) )
	    {
		Swap(Exceptions, i);
		Exceptions++;
	    }
	}
        Exceptions -= Window;
	TotalErrors = Errors + Exceptions;

	/*  Print error analysis  */

	printf("%3d  %7d  %8d  %6d  %8d%5.1f%%  %6d%5.1f%%  %6d%5.1f%%\n",
	       ++Cycle, TreeSize(Classifier), Window, MaxItem-Window+1,
	       Errors, 100*(float)Errors/Window,
	       Exceptions, 100*Exceptions/(MaxItem-Window+1.001),
	       TotalErrors, 100*TotalErrors/(MaxItem+1.0));

	/*  Keep track of the most successful classifier tree so far  */

	if ( ! BestClassifier || TotalErrors < BestTotalErrors )
	{
	    if ( BestClassifier ) ReleaseTree(BestClassifier);
	    BestClassifier = Classifier;
	    BestTotalErrors = TotalErrors;
        }
	else
	{
	    ReleaseTree(Classifier);
	}

	/*  Increment window size  */

	Additions = Min(Exceptions, IncExceptions);
	Window = Min(Window + Max(Additions, Exceptions / 2), MaxItem + 1);
    }
    while ( Exceptions );

    return BestClassifier;
}



/*************************************************************************/
/*									 */
/*	Print report of errors for each of the trials			 */
/*									 */
/*************************************************************************/


    Evaluate(CMInfo, Saved)
/*  --------  */
    Boolean CMInfo;
    short Saved;
{
    ClassNo RealClass, PrunedClass, Category();
    short t;
    ItemNo *ConfusionMat, i, RawErrors, PrunedErrors;

    if ( CMInfo )
    {
	ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
    }

    printf("\n");

    if ( TRIALS > 1 )
    {
	printf("Trial\t Before Pruning           After Pruning\n");
	printf("-----\t----------------   ---------------------------\n");
    }
    else
    {
	printf("\t Before Pruning           After Pruning\n");
	printf("\t----------------   ---------------------------\n");
    }
    printf("\tSize      Errors   Size      Errors   Estimate\n\n");

    ForEach(t, 0, TRIALS-1)
    {
	RawErrors = PrunedErrors = 0;

	ForEach(i, 0, MaxItem)
	{
	    RealClass = Class(Item[i]);

	    if ( Category(Item[i], Raw[t]) != RealClass ) RawErrors++;

	    PrunedClass = Category(Item[i], Pruned[t]);

	    if ( PrunedClass != RealClass ) PrunedErrors++;

	    if ( CMInfo && t == Saved )
	    {
		ConfusionMat[RealClass*(MaxClass+1)+PrunedClass]++;
	    }
	}
    
	if ( TRIALS > 1 )
	{
	    printf("%4d", t);
	}

	printf("\t%4d  %3d(%4.1f%%)   %4d  %3d(%4.1f%%)    (%4.1f%%)%s\n",
	       TreeSize(Raw[t]), RawErrors, 100.0*RawErrors / (MaxItem+1.0),
	       TreeSize(Pruned[t]), PrunedErrors, 100.0*PrunedErrors / (MaxItem+1.0),
	       100 * Pruned[t]->Errors / Pruned[t]->Items,
	       ( t == Saved ? "   <<" : "" ));
    }

    if ( CMInfo )
    {
	PrintConfusionMatrix(ConfusionMat);
	free(ConfusionMat);
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产自产在线| 国产精品自在欧美一区| 在线观看亚洲一区| 亚洲天堂2016| 在线观看日韩电影| 日韩av网站在线观看| 日韩视频免费观看高清完整版| 狂野欧美性猛交blacked| 精品国产百合女同互慰| 国产91清纯白嫩初高中在线观看| 国产精品你懂的在线| 色婷婷国产精品| 日韩av一区二区三区四区| 精品国产乱码久久久久久闺蜜| 国产99久久久久久免费看农村| 日韩毛片在线免费观看| 欧美性极品少妇| 极品美女销魂一区二区三区 | 成人h动漫精品一区二区| 亚洲人成人一区二区在线观看| 欧美午夜电影网| 精东粉嫩av免费一区二区三区| 亚洲国产岛国毛片在线| 欧美亚洲国产一卡| 激情伊人五月天久久综合| 亚洲欧美日韩国产另类专区| 欧美一级一级性生活免费录像| 高清在线不卡av| 亚洲一区二区三区在线播放| 久久一区二区视频| 在线精品亚洲一区二区不卡| 国产在线一区观看| 一区二区欧美视频| 久久久777精品电影网影网| 欧美亚日韩国产aⅴ精品中极品| 久久精品国产精品亚洲精品| 亚洲靠逼com| 久久久99精品久久| 3d动漫精品啪啪一区二区竹菊| 成人综合婷婷国产精品久久免费| 视频一区在线视频| 亚洲另类在线制服丝袜| 久久奇米777| 欧美高清视频在线高清观看mv色露露十八| 国产不卡一区视频| 青娱乐精品在线视频| 亚洲码国产岛国毛片在线| 精品久久久久久久一区二区蜜臀| 欧美视频在线不卡| 99久久精品国产毛片| 激情国产一区二区 | 日本成人在线一区| 中文字幕字幕中文在线中不卡视频| 精品乱人伦一区二区三区| 欧美亚洲高清一区二区三区不卡| 国产成人日日夜夜| 欧美日本一道本在线视频| heyzo一本久久综合| 国产精选一区二区三区| 理论片日本一区| 日韩高清欧美激情| 亚洲影视在线观看| 亚洲伦在线观看| 亚洲视频你懂的| 国产精品久久久久久久久久免费看| 欧美精品一区二区三区高清aⅴ| 欧美一区二区三区免费大片| 欧美午夜精品久久久久久孕妇| 日本精品一级二级| 色综合激情久久| 在线免费观看日本一区| 色吊一区二区三区| 欧美曰成人黄网| 色婷婷亚洲精品| 久久精品国产99国产精品| 波多野结衣欧美| 亚洲一区二区视频在线| 亚洲精品免费播放| 亚洲一二三区在线观看| 亚洲精品美国一| 五月综合激情婷婷六月色窝| 婷婷综合久久一区二区三区| 五月婷婷综合在线| 日韩精品色哟哟| 另类小说视频一区二区| 国产乱人伦精品一区二区在线观看 | 中文一区二区完整视频在线观看 | 日韩欧美国产午夜精品| 在线91免费看| 久久蜜桃av一区精品变态类天堂 | 欧美一区二区三级| 日韩欧美色综合| 久久久久久久久久电影| 国产精品久久久久影院| 一区二区三区欧美久久| 五月婷婷欧美视频| 国产一区二区不卡老阿姨| 成人av午夜影院| 欧美日韩精品是欧美日韩精品| 欧美一区二区在线播放| 国产欧美一区二区精品忘忧草 | 国产在线精品国自产拍免费| 国产夫妻精品视频| 色老头久久综合| 日韩一级片网站| 亚洲欧洲精品成人久久奇米网| 亚洲国产综合91精品麻豆| 麻豆一区二区三| av在线不卡免费看| 在线电影国产精品| 国产日韩影视精品| 亚洲一区二区av电影| 麻豆精品一二三| 97se亚洲国产综合在线| 欧美一区二区日韩| 亚洲欧洲成人精品av97| 日韩精品成人一区二区三区| 国产精品一区专区| 欧美在线啊v一区| 美女国产一区二区| gogogo免费视频观看亚洲一| 欧美一区二区精美| 成人欧美一区二区三区黑人麻豆| 日本伊人色综合网| 99综合电影在线视频| 日韩欧美国产一区在线观看| 亚洲人成网站色在线观看| 国内成人自拍视频| 91福利小视频| 亚洲国产成人自拍| 极品少妇xxxx精品少妇| 欧美色图免费看| 国产日本欧洲亚洲| 毛片av一区二区| 欧美日韩国产成人在线91 | 18欧美亚洲精品| 久久99国产精品久久| 欧洲国内综合视频| 久久久91精品国产一区二区精品 | 一本大道久久a久久精品综合 | 国产精品嫩草久久久久| 久久成人久久鬼色| 69成人精品免费视频| 亚洲免费电影在线| 高清av一区二区| 欧美精品一区二区三区在线| 日本伊人午夜精品| 欧美日韩在线播| 亚洲一区二区精品视频| 91视频精品在这里| 国产精品色在线观看| 国产精品白丝jk黑袜喷水| 欧美电影免费观看完整版| 青椒成人免费视频| 91超碰这里只有精品国产| 午夜久久久久久| 欧美日韩高清在线播放| 亚洲高清在线精品| 欧美午夜电影一区| 亚洲成av人片一区二区| 日本道免费精品一区二区三区| 中文字幕在线免费不卡| 成人免费观看视频| 亚洲欧美成人一区二区三区| www.亚洲在线| 亚洲三级久久久| 一本一道久久a久久精品 | 91超碰这里只有精品国产| 午夜av区久久| 欧美一区二区精美| 国产一区二区三区免费观看| 日韩一级大片在线观看| 麻豆精品久久精品色综合| 欧美成人三级电影在线| 免费成人在线观看| 欧美精品一区二区三区在线播放| 久久成人久久鬼色| 日本一区二区免费在线观看视频| 成人性色生活片免费看爆迷你毛片| 久久久精品tv| 色综合久久88色综合天天 | 亚洲精品一区二区三区精华液| 国精产品一区一区三区mba视频| 国产亚洲污的网站| 99精品视频一区| 午夜亚洲国产au精品一区二区| 欧美一区二区三区免费在线看| 国产一区日韩二区欧美三区| 国产精品久久免费看| 欧洲亚洲国产日韩| 另类专区欧美蜜桃臀第一页| 国产午夜亚洲精品不卡| 波多野结衣中文一区| 一区二区在线看| 91.xcao| 懂色av一区二区三区蜜臀| 亚洲丝袜美腿综合| 91精品婷婷国产综合久久| 国产成人精品亚洲777人妖| 亚洲精品写真福利|