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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? build.c

?? 決策樹是用二叉樹形圖來表示處理邏輯的一種工具。可以直觀、清晰地表達加工的邏輯要求。特別適合于判斷因素比較少、邏輯組合關系不復雜的情況。
?? C
字號:
/*************************************************************************//*								 	 *//*    Central tree-forming algorithm incorporating all criteria  	 *//*    ---------------------------------------------------------	 	 *//*								 	 *//*************************************************************************/#include "defns.i"#include "types.i"#include "extern.i"ItemCount	*Weight,	/* Weight[i]  = current fraction of item i */	**Freq,		/* Freq[x][c] = no. items of class c with outcome x */	*ValFreq,	/* ValFreq[x]   = no. items with outcome x */	*ClassFreq;	/* ClassFreq[c] = no. items of class c */float	*Gain,		/* Gain[a] = info gain by split on att a */	*Info,		/* Info[a] = potential info of split on att a */	*Bar,		/* Bar[a]  = best threshold for contin att a */	*UnknownRate;	/* UnknownRate[a] = current unknown rate for att a */Boolean	*Tested,	/* Tested[a] set if att a has already been tested */	MultiVal;	/* true when all atts have many values */	/*  External variables initialised here  */extern float	*SplitGain,	/* SplitGain[i] = gain with att value of item i as threshold */	*SplitInfo;	/* SplitInfo[i] = potential info ditto */extern ItemCount	*Slice1,	/* Slice1[c]    = saved values of Freq[x][c] in subset.c */	*Slice2;	/* Slice2[c]    = saved values of Freq[y][c] */extern Set	**Subset;	/* Subset[a][s] = subset s for att a */extern short	*Subsets;	/* Subsets[a] = no. subsets for att a *//*************************************************************************//*								 	 *//*		Allocate space for tree tables			 	 *//*								 	 *//*************************************************************************/    InitialiseTreeData()/*  ------------------  */{     DiscrValue v;    Attribute a;    Tested	= (char *) calloc(MaxAtt+1, sizeof(char));    Gain	= (float *) calloc(MaxAtt+1, sizeof(float));    Info	= (float *) calloc(MaxAtt+1, sizeof(float));    Bar		= (float *) calloc(MaxAtt+1, sizeof(float));    Subset = (Set **) calloc(MaxAtt+1, sizeof(Set *));    ForEach(a, 0, MaxAtt)    {	if ( MaxAttVal[a] )	{	    Subset[a]  = (Set *) calloc(MaxDiscrVal+1, sizeof(Set));	    ForEach(v, 0, MaxAttVal[a])	    {		Subset[a][v] = (Set) malloc((MaxAttVal[a]>>3) + 1);	    }	}    }    Subsets = (short *) calloc(MaxAtt+1, sizeof(short));    SplitGain = (float *) calloc(MaxItem+1, sizeof(float));    SplitInfo = (float *) calloc(MaxItem+1, sizeof(float));    Weight = (ItemCount *) calloc(MaxItem+1, sizeof(ItemCount));    Freq  = (ItemCount **) calloc(MaxDiscrVal+1, sizeof(ItemCount *));    ForEach(v, 0, MaxDiscrVal)    {	Freq[v]  = (ItemCount *) calloc(MaxClass+1, sizeof(ItemCount));    }    ValFreq = (ItemCount *) calloc(MaxDiscrVal+1, sizeof(ItemCount));    ClassFreq = (ItemCount *) calloc(MaxClass+1, sizeof(ItemCount));    Slice1 = (ItemCount *) calloc(MaxClass+2, sizeof(ItemCount));    Slice2 = (ItemCount *) calloc(MaxClass+2, sizeof(ItemCount));    UnknownRate = (float *) calloc(MaxAtt+1, sizeof(float));    /*  Check whether all attributes have many discrete values  */    MultiVal = true;    if ( ! SUBSET )    {	for ( a = 0 ; MultiVal && a <= MaxAtt ; a++ )	{	    if ( SpecialStatus[a] != IGNORE )	    {		MultiVal = MaxAttVal[a] >= 0.3 * (MaxItem + 1);	    }	}    }}/*************************************************************************//*								 	 *//*		Initialise the weight of each item		 	 *//*								 	 *//*************************************************************************/    InitialiseWeights()/*  -----------------  */{    ItemNo i;    ForEach(i, 0, MaxItem)    {        Weight[i] = 1.0;    }}/*************************************************************************//*								 	 *//*  Build a decision tree for the cases Fp through Lp:		 	 *//*								 	 *//*  - if all cases are of the same class, the tree is a leaf and so	 *//*      the leaf is returned labelled with this class		 	 *//*								 	 *//*  - for each attribute, calculate the potential information provided 	 *//*	by a test on the attribute (based on the probabilities of each	 *//*	case having a particular value for the attribute), and the gain	 *//*	in information that would result from a test on the attribute	 *//*	(based on the probabilities of each case with a particular	 *//*	value for the attribute being of a particular class)		 *//*								 	 *//*  - on the basis of these figures, and depending on the current	 *//*	selection criterion, find the best attribute to branch on. 	 *//*	Note:  this version will not allow a split on an attribute	 *//*	unless two or more subsets have at least MINOBJS items. 	 *//*								 	 *//*  - try branching and test whether better than forming a leaf	 	 *//*								 	 *//*************************************************************************/Tree FormTree(Fp, Lp)/*   ---------  */    ItemNo Fp, Lp; {     ItemNo i, Kp, Ep, Group();    ItemCount Cases, NoBestClass, KnownCases, CountItems();    float Factor, BestVal, Val, AvGain=0, Worth();    Attribute Att, BestAtt, Possible=0;    ClassNo c, BestClass;    Tree Node, Leaf();    DiscrValue v;    Boolean PrevAllKnown;    Cases = CountItems(Fp, Lp);    /*  Generate the class frequency distribution  */    ForEach(c, 0, MaxClass)    {	ClassFreq[c] = 0;    }    ForEach(i, Fp, Lp)    { 	ClassFreq[ Class(Item[i]) ] += Weight[i];    }     /*  Find the most frequent class  */    BestClass = 0;    ForEach(c, 0, MaxClass)    {	if ( ClassFreq[c] > ClassFreq[BestClass] )	{	    BestClass = c;	}    }    NoBestClass = ClassFreq[BestClass];    Node = Leaf(ClassFreq, BestClass, Cases, Cases - NoBestClass);    /*  If all cases are of the same class or there are not enough	cases to divide, the tree is a leaf  */    if ( NoBestClass == Cases  || Cases < 2 * MINOBJS )    { 	return Node;    }     Verbosity(1)    	printf("\n%d items, total weight %.1f\n", Lp - Fp + 1, Cases);    /*  For each available attribute, find the information and gain  */    ForEach(Att, 0, MaxAtt)     { 	Gain[Att] = -Epsilon;	if ( SpecialStatus[Att] == IGNORE ) continue;        if ( MaxAttVal[Att] )	{	    /*  discrete valued attribute  */	    if ( SUBSET && MaxAttVal[Att] > 2 )	    {		EvalSubset(Att, Fp, Lp, Cases);	    }	    else	    if ( ! Tested[Att] )	    {	        EvalDiscreteAtt(Att, Fp, Lp, Cases);	    }	}	else	{ 	    /*  continuous attribute  */	    EvalContinuousAtt(Att, Fp, Lp);	} 	/*  Update average gain, excluding attributes with very many values  */	if ( Gain[Att] > -Epsilon &&	     ( MultiVal || MaxAttVal[Att] < 0.3 * (MaxItem + 1) ) )	{	    Possible++;	    AvGain += Gain[Att];	}    }     /*  Find the best attribute according to the given criterion  */    BestVal = -Epsilon;    BestAtt = None;    AvGain  = ( Possible ? AvGain / Possible : 1E6 );    Verbosity(2)    {	if ( AvGain < 1E6 ) printf("\taverage gain %.3f\n", AvGain);    }    ForEach(Att, 0, MaxAtt)     { 	if ( Gain[Att] > -Epsilon )	{ 	    Val = Worth(Info[Att], Gain[Att], AvGain);	    if ( Val > BestVal ) 	    { 	        BestAtt  = Att; 	        BestVal = Val;	    } 	}     }     /*  Decide whether to branch or not  */     if ( BestAtt != None )    { 	Verbosity(1)	{	    printf("\tbest attribute %s", AttName[BestAtt]);	    if ( ! MaxAttVal[BestAtt] )	    {		printf(" cut %.3f", Bar[BestAtt]);	    }	    printf(" inf %.3f gain %.3f val %.3f\n",		   Info[BestAtt], Gain[BestAtt], BestVal);	}		/*  Build a node of the selected test  */        if ( MaxAttVal[BestAtt] )	{	    /*  Discrete valued attribute  */	    if ( SUBSET && MaxAttVal[BestAtt] > 2 )	    {	        SubsetTest(Node, BestAtt);	    }	    else	    {	        DiscreteTest(Node, BestAtt);	    }	}	else	{ 	    /*  Continuous attribute  */	    ContinTest(Node, BestAtt);	} 	/*  Remove unknown attribute values  */	PrevAllKnown = AllKnown;	Kp = Group(0, Fp, Lp, Node) + 1;	if ( Kp != Fp ) AllKnown = false;	KnownCases = Cases - CountItems(Fp, Kp-1);	UnknownRate[BestAtt] = (Cases - KnownCases) / (Cases + 0.001);	Verbosity(1)	{	    if ( UnknownRate[BestAtt] > 0 )	    {		printf("\tunknown rate for %s = %.3f\n",		       AttName[BestAtt], UnknownRate[BestAtt]);	    }	}	/*  Recursive divide and conquer  */	++Tested[BestAtt];	Ep = Kp - 1;	Node->Errors = 0;	ForEach(v, 1, Node->Forks)	{	    Ep = Group(v, Kp, Lp, Node);	    if ( Kp <= Ep )	    {		Factor = CountItems(Kp, Ep) / KnownCases;		ForEach(i, Fp, Kp-1)		{		    Weight[i] *= Factor;		}		Node->Branch[v] = FormTree(Fp, Ep);		Node->Errors += Node->Branch[v]->Errors;		Group(0, Fp, Ep, Node);		ForEach(i, Fp, Kp-1)		{		    Weight[i] /= Factor;		}	    }	    else	    {		Node->Branch[v] = Leaf(Node->ClassDist, BestClass, 0.0, 0.0);	    }	}	--Tested[BestAtt];	AllKnown = PrevAllKnown;	/*  See whether we would have been no worse off with a leaf  */	if ( Node->Errors >= Cases - NoBestClass - Epsilon )	{ 	    Verbosity(1)		printf("Collapse tree for %d items to leaf %s\n",	                Lp - Fp + 1, ClassName[BestClass]);	    Node->NodeType = 0;	}     }    else    { 	Verbosity(1)	    printf("\tno sensible splits  %.1f/%.1f\n",		   Cases, Cases - NoBestClass);    }     return Node; } /*************************************************************************//*								 	 *//*  Group together the items corresponding to branch V of a test 	 *//*  and return the index of the last such			 	 *//*								 	 *//*  Note: if V equals zero, group the unknown values		 	 *//*								 	 *//*************************************************************************/ItemNo Group(V, Fp, Lp, TestNode)/*     -----  */    DiscrValue V;    ItemNo Fp, Lp;    Tree TestNode;{    ItemNo i;    Attribute Att;    float Thresh;    Set SS;    void Swap();    Att = TestNode->Tested;    if ( V )    {	/*  Group items on the value of attribute Att, and depending	    on the type of branch  */	switch ( TestNode->NodeType )	{	    case BrDiscr:		ForEach(i, Fp, Lp)		{		    if ( DVal(Item[i], Att) == V ) Swap(Fp++, i);		}		break;	    case ThreshContin:		Thresh = TestNode->Cut;		ForEach(i, Fp, Lp)		{		    if ( (CVal(Item[i], Att) <= Thresh) == (V == 1) ) Swap(Fp++, i);		}		break;	    case BrSubset:		SS = TestNode->Subset[V];		ForEach(i, Fp, Lp)		{		    if ( In(DVal(Item[i], Att), SS) ) Swap(Fp++, i);		}		break;	}    }    else    {	/*  Group together unknown values  */	switch ( TestNode->NodeType )	{	    case BrDiscr:	    case BrSubset:		ForEach(i, Fp, Lp)		{		    if ( ! DVal(Item[i], Att) ) Swap(Fp++, i);		}		break;	    case ThreshContin:		ForEach(i, Fp, Lp)		{		    if ( CVal(Item[i], Att) == Unknown ) Swap(Fp++, i);		}		break;	}    }    return Fp - 1;}/*************************************************************************//*								 	 *//*	Return the total weight of items from Fp to Lp		 	 *//*								 	 *//*************************************************************************/ItemCount CountItems(Fp, Lp)/*        ----------  */    ItemNo Fp, Lp;{    register ItemCount Sum=0.0, *Wt, *LWt;    if ( AllKnown ) return Lp - Fp + 1;    for ( Wt = Weight + Fp, LWt = Weight + Lp ; Wt <= LWt ; )    {	Sum += *Wt++;    }    return Sum;}/*************************************************************************//*                                                               	 *//*		Exchange items at a and b			 	 *//*									 *//*************************************************************************/void Swap(a,b)/*   ----  */    ItemNo a, b;{    register Description Hold;    register ItemCount HoldW;    Hold = Item[a];    Item[a] = Item[b];    Item[b] = Hold;    HoldW = Weight[a];    Weight[a] = Weight[b];    Weight[b] = HoldW;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区自拍偷拍| 国产精品一区二区你懂的| 日韩成人精品在线观看| 国产福利一区二区三区视频在线 | 久久成人免费网| 99久久免费精品高清特色大片| 欧美老肥妇做.爰bbww视频| 国产日本欧洲亚洲| 日本v片在线高清不卡在线观看| 99久久er热在这里只有精品66| 欧美成人福利视频| 亚洲6080在线| 成人一二三区视频| 精品日产卡一卡二卡麻豆| 亚洲激情图片小说视频| 国产91丝袜在线播放| 精品国产亚洲一区二区三区在线观看| 亚洲黄网站在线观看| 国产成人精品三级麻豆| 欧美一级欧美三级在线观看| 悠悠色在线精品| 91在线精品一区二区| 欧美国产精品一区| 国产成人自拍高清视频在线免费播放| 欧美一级在线视频| 日韩影院免费视频| 欧美绝品在线观看成人午夜影视| 亚洲精品成人精品456| 99久久99久久精品国产片果冻| 国产三级久久久| 国产成人av一区| 久久综合久久综合久久| 国产另类ts人妖一区二区| 欧美成人国产一区二区| 狠狠色狠狠色合久久伊人| 欧美一区二区三区四区高清| 午夜精品视频一区| 欧美精品日韩一本| 琪琪久久久久日韩精品| 91精品国产免费| 美美哒免费高清在线观看视频一区二区 | 国产成人午夜片在线观看高清观看| 日韩一卡二卡三卡国产欧美| 日韩av中文字幕一区二区三区| 欧美日韩亚洲综合一区二区三区| 亚洲国产成人porn| 欧美区视频在线观看| 婷婷综合在线观看| 日韩欧美国产综合一区| 狠狠色丁香久久婷婷综合_中| 亚洲精品一区二区三区99| 国产麻豆精品在线| 国产精品久久久久久久蜜臀| 一本色道亚洲精品aⅴ| 一区二区三区免费看视频| 欧美在线不卡一区| 美女免费视频一区二区| 中文字幕av不卡| 欧美专区亚洲专区| 日本麻豆一区二区三区视频| 久久久国产精品不卡| 99天天综合性| 亚洲激情自拍视频| 欧美美女一区二区在线观看| 毛片av一区二区| 日韩一区在线免费观看| 欧美日韩国产精品成人| 国模一区二区三区白浆 | 欧美mv日韩mv国产网站app| 成人午夜短视频| 亚洲成av人片www| 精品国产乱码久久久久久久久| 成人黄色av网站在线| 视频在线在亚洲| 中文字幕一区二区三区在线播放 | 国产亚洲精品精华液| 一本大道综合伊人精品热热 | 一区二区在线观看不卡| 欧美一级搡bbbb搡bbbb| aaa欧美色吧激情视频| 日韩av中文字幕一区二区三区| 国产精品国产自产拍高清av | 久久99蜜桃精品| 一区二区三区在线视频观看58| 久久综合精品国产一区二区三区| 在线看一区二区| 成人av影院在线| 韩国精品在线观看| 午夜一区二区三区在线观看| 日本一二三四高清不卡| 精品奇米国产一区二区三区| 欧美色综合影院| av成人动漫在线观看| 国产成人鲁色资源国产91色综| 午夜久久久久久久久| 亚洲乱码国产乱码精品精的特点 | 亚洲自拍偷拍九九九| 国产色综合一区| 欧美成人r级一区二区三区| 欧美色精品天天在线观看视频| 夫妻av一区二区| 国产一区二区三区免费播放| 九九九久久久精品| 日韩精品一二三区| 偷拍一区二区三区| 日韩电影一二三区| 视频一区视频二区中文字幕| 亚洲午夜久久久久久久久久久| 自拍偷拍亚洲欧美日韩| 国产精品不卡在线| 国产精品福利电影一区二区三区四区| 久久久噜噜噜久久中文字幕色伊伊 | 美女www一区二区| 奇米一区二区三区| 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲综合激情网| 亚洲va在线va天堂| 日韩电影在线免费观看| 欧美aaaaa成人免费观看视频| 天堂蜜桃一区二区三区| 琪琪一区二区三区| 国产综合色产在线精品| 国产高清亚洲一区| 国产精品66部| 成人午夜在线免费| 91丨国产丨九色丨pron| 91看片淫黄大片一级在线观看| 成人精品免费看| 日本韩国一区二区三区视频| 在线播放亚洲一区| 精品久久久久久久人人人人传媒 | 国产精品国产三级国产aⅴ中文 | 久久综合给合久久狠狠狠97色69| 精品99一区二区| 中文字幕在线视频一区| 亚洲精品视频在线| 亚洲国产精品一区二区久久| 日韩精品成人一区二区三区| 久久爱另类一区二区小说| 国产福利视频一区二区三区| 91免费观看在线| 欧美精品日韩综合在线| 久久亚区不卡日本| 亚洲精品久久久久久国产精华液| 水野朝阳av一区二区三区| 国产一区三区三区| 色系网站成人免费| 日韩亚洲欧美综合| 国产精品久久久久影院色老大| 亚洲午夜精品在线| 国产一区二区三区电影在线观看| av高清久久久| 欧美一区二区三区四区高清| 日本一区二区三区久久久久久久久不| 一区二区三区色| 国内久久精品视频| 欧美性做爰猛烈叫床潮| 2020国产精品| 亚洲国产综合人成综合网站| 国产一区二区视频在线播放| 91麻豆成人久久精品二区三区| 日韩欧美激情四射| 一区二区三区国产| 成人午夜视频免费看| 欧美一级久久久久久久大片| 亚洲欧洲另类国产综合| 精品一区二区三区香蕉蜜桃| 91污在线观看| 久久色.com| 热久久久久久久| 日本精品一区二区三区高清 | 成人手机在线视频| 在线观看91精品国产麻豆| 调教+趴+乳夹+国产+精品| 成人免费视频播放| 欧美精品一区二区久久婷婷| 亚洲成人久久影院| 色狠狠一区二区三区香蕉| 久久久www免费人成精品| 日韩国产精品久久久| 色女孩综合影院| 亚洲欧美一区二区视频| 国产一区不卡在线| 日韩女优毛片在线| 午夜精品一区在线观看| 欧美影视一区在线| 亚洲欧美偷拍三级| 99久久伊人精品| 亚洲欧洲精品一区二区三区不卡| 国产一区高清在线| 精品国产免费人成在线观看| 日日夜夜一区二区| 3d动漫精品啪啪一区二区竹菊| 亚洲在线中文字幕| 欧美怡红院视频| 亚洲成人av一区二区三区| 欧洲精品一区二区三区在线观看| 亚洲欧美日韩中文播放 | 亚洲免费资源在线播放| 高清beeg欧美|