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

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

?? subset.c

?? 數據挖掘c4.5算法(vc語言版本)歡迎大家下載測試!!!!
?? C
字號:
/*************************************************************************/
/*									 */
/*      Evaluation of the subsetting of a discrete attribute		 */
/*      ----------------------------------------------------		 */
/*									 */
/*************************************************************************/


#include "buildex.i"


ItemCount
	*Slice1,	/* Slice1[c]    = saved values of Freq[x][c] in subset.c */
	*Slice2;	/* Slice2[c]    = saved values of Freq[y][c] */

Set
	**Subset;	/* Subset[a][s] = subset s for att a */

short
	*Subsets;	/* Subsets[a] = no. subsets for att a */



/*************************************************************************/
/*									 */
/*  Evaluate subsetting a discrete attribute and form the chosen	 */
/*  subsets Subset[Att][], setting Subsets[Att] to the number of	 */
/*  subsets, and the Info[] and Gain[] of a test on the attribute	 */
/*									 */
/*************************************************************************/


    EvalSubset(Att, Fp, Lp, Items)
/*  ----------  */ 
    Attribute Att;
    ItemNo Fp, Lp; 
    ItemCount Items;
{ 
    DiscrValue V1, V2, BestV1, BestV2, Barred;
    ItemCount KnownItems;
    ClassNo c;
    float BaseInfo, MinGain, ThisGain, ThisInfo,
	Val, BestVal, BestGain, BestInfo,
	PrevVal, PrevGain, PrevInfo,
	DiscrKnownBaseInfo(), Worth(), ComputeGain(), TotalInfo();
    short Blocks=0, MissingValues=0, ReasonableSubsets, Bytes, b;
    Boolean MergedSubsets = false;
    int SaveMINOBJS;

    SaveMINOBJS = MINOBJS;
    MINOBJS = 1;

    /*  First compute Freq[][], ValFreq[], base info, and the gain
	and total info of a split on discrete attribute Att  */

    ComputeFrequencies(Att, Fp, Lp);

    KnownItems = Items - ValFreq[0];
    if ( KnownItems < Epsilon )
    {
	Verbosity(2) printf("\tAtt %s: no known values\n", AttName[Att]);

	Gain[Att] = -Epsilon;
	Info[Att] = 0;
	return;
    }

    BaseInfo = DiscrKnownBaseInfo(KnownItems, MaxAttVal[Att]);

    PrevGain = ComputeGain(BaseInfo, UnknownRate[Att], MaxAttVal[Att],KnownItems);
    PrevInfo = TotalInfo(ValFreq, 0, MaxAttVal[Att]) / Items;
    PrevVal = Worth(PrevInfo, PrevGain, Epsilon);

    Verbosity(2)
    {
	printf("\tAtt %s", AttName[Att]);

	Verbosity(3) PrintDistribution(Att, MaxAttVal[Att], true);

	printf("\tinf %.3f, gain %.3f, val=%.3f\n",
		PrevInfo, PrevGain, PrevVal);
    }

    /*  Eliminate unrepresented attribute values from Freq[] and ValFreq[]
	and form a separate subset for each represented attribute value  */

    Bytes = (MaxAttVal[Att]>>3) + 1;
    ClearBits(Bytes, Subset[Att][0]);

    ForEach(V1, 1, MaxAttVal[Att])
    {
	if ( ValFreq[V1] > 0.5 )
	{
	    if ( ++Blocks < V1 )
	    {
		ValFreq[Blocks] = ValFreq[V1];
		ForEach(c, 0, MaxClass)
		{
		    Freq[Blocks][c] = Freq[V1][c];
		}
	    }
	    ClearBits(Bytes, Subset[Att][Blocks]);
	    SetBit(V1, Subset[Att][Blocks]);
	}
	else
	{
	    SetBit(V1, Subset[Att][0]);
	    MissingValues++;
	}
    }

    /*  Merge any single-class subsets with others of the same class  */
    /*  Note: have ValFreq[V] > 0 for all V  */

    ForEach(V1, 1, Blocks-1)
    {
	for ( c = 0 ; Freq[V1][c] < 0.1 ; c++ )
	    ;

	if ( Freq[V1][c] < ValFreq[V1] - 0.1 ) continue;

	/*  Now have a single class -- look for others  */

	for ( V2 = V1+1 ; V2 <= Blocks ; )
	{
	    if ( Freq[V2][c] < ValFreq[V2] - 0.1 )
	    {
		V2++;
	    }
	    else
	    {
		/*  Merge these subsets  */

		Combine(V1, V2, Blocks);

		ForEach(b, 0, Bytes-1)
		{
		    Subset[Att][V1][b] |= Subset[Att][V2][b];
		    Subset[Att][V2][b] = Subset[Att][Blocks][b];
		}

		Blocks--;
		MergedSubsets = true;
	    }
	}
    }

    if ( MergedSubsets )
    {
	PrevGain = ComputeGain(BaseInfo, UnknownRate[Att], Blocks, KnownItems);
	PrevInfo = TotalInfo(ValFreq, 0, Blocks) / Items;
	PrevVal = Worth(PrevInfo, PrevGain, Epsilon);

	Verbosity(2)
	{
	    printf("\tAfter merging single-class subsets:");

	    Verbosity(3) PrintDistribution(Att, Blocks, false);

	    printf("\tinf %.3f, gain %.3f, val=%.3f\n",
		    PrevInfo, PrevGain, PrevVal);
	}
    }

    /*  Examine possible pair mergers and hill-climb  */

    MinGain = PrevGain / 2;

    while ( Blocks > 2 )
    {
	BestVal = BestV1 = 0;
	BestGain = -Epsilon;

	/*  Check reasonable subsets; if less than 3, bar mergers
	    involving the largest block  */

	ReasonableSubsets = 0;
	Barred = 1;

	ForEach(V1, 1, Blocks)
	{
	    if ( ValFreq[V1] >= SaveMINOBJS ) ReasonableSubsets++;

	    if ( ValFreq[V1] > ValFreq[Barred] ) Barred = V1;
	}

	if ( ReasonableSubsets >= 3 ) Barred = 0;

	/*  For each possible pair of values, calculate the gain and
	    total info of a split in which they are treated as one.
	    Keep track of the pair with the best gain.  */

	ForEach(V1, 1, Blocks-1)
	{
	    ForEach(V2, V1+1, Blocks)
	    {
		if ( V1 == Barred || V2 == Barred ) continue;

		Combine(V1, V2, Blocks);

		ThisGain = ComputeGain(BaseInfo, UnknownRate[Att],
					Blocks-1, KnownItems);
		ThisInfo = TotalInfo(ValFreq, 0, Blocks-1) / Items;
		Val      = Worth(ThisInfo, ThisGain, Epsilon);

		Verbosity(4)
		{
		    printf("\tcombine %d %d info %.3f gain %.3f val %.3f",
		           V1, V2, ThisInfo, ThisGain, Val);
		    PrintDistribution(Att, Blocks-1, false);
		}

		/*  Force a split if
			less than two reasonable subsets, or
			using GAIN criterion
		    Prefer this split to the previous one if
			gain >= MinGain (and previous < MinGain), or
			val >= previous best val  */

		if ( ThisGain >= MinGain && BestGain < MinGain ||
		     Val >= BestVal ||
		     ! BestV1 && ( ! GAINRATIO || ReasonableSubsets < 2 ) )
		{
		    BestVal  = Val;
		    BestGain = ThisGain;
		    BestInfo = ThisInfo;
		    BestV1   = V1;
		    BestV2   = V2;
		}

		Uncombine(V1, V2);
	    }
	}

	if ( GAINRATIO &&
	     ReasonableSubsets >= 2 &&
	     ( ! BestV1 ||
	       BestVal < PrevVal + 1E-5 ||
	       BestVal == PrevVal && BestGain < PrevGain ) ) break;

	PrevGain = BestGain;
	PrevInfo = BestInfo;
        PrevVal = BestVal;

	Combine(BestV1, BestV2, Blocks);

	ForEach(b, 0, Bytes-1)
	{
	    Subset[Att][BestV1][b] |= Subset[Att][BestV2][b];
	    Subset[Att][BestV2][b] = Subset[Att][Blocks][b];
	}

	Blocks--;

	Verbosity(2)
	{
	    printf("\t\tform subset ");
	    PrintSubset(Att, Subset[Att][BestV1]);
	    printf(": %d subsets, inf %.3f, gain %.3f, val %.3f\n",
		   Blocks, BestInfo, BestGain, BestVal);
	    Verbosity(3)
	    {
		printf("\t\tcombine %d, %d", BestV1, BestV2);
		PrintDistribution(Att, Blocks, false);
	    }
	}
    }

    MINOBJS = SaveMINOBJS;

    if ( PrevVal <= 0 )
    {
	Gain[Att] = -Epsilon;
	Info[Att] = 0;
    }
    else
    {
	Gain[Att] = ComputeGain(BaseInfo, UnknownRate[Att], Blocks, KnownItems);
	Info[Att] = PrevInfo;

	if ( MissingValues )
	{
	    Blocks++;
	    CopyBits(Bytes, Subset[Att][0], Subset[Att][Blocks]);
	}

	Subsets[Att] = Blocks;

	Verbosity(2) printf("\tFinal subsets:");
	Verbosity(3) PrintDistribution(Att, Blocks, false);
	Verbosity(2)
	    printf("\tinf %.3f gain %.3f val %.3f\n", 
		   Info[Att], Gain[Att], Worth(Info[Att], Gain[Att], Epsilon));
    }
}



/*************************************************************************/
/*									 */
/*  Combine the distribution figures of discrete attribute values	 */
/*  x and y, putting the combined figures in Freq[x][] and		 */
/*  ValFreq[x][], and saving old values in Slice1 and Slice2		 */
/*									 */
/*************************************************************************/


    Combine(x, y, Last)
/*  -------  */
    DiscrValue x, y, Last;
{
    ClassNo c;

    ForEach(c, 0, MaxClass)
    {
	Slice1[c] = Freq[x][c];
	Slice2[c] = Freq[y][c];

	Freq[x][c] += Freq[y][c];
	Freq[y][c]  = Freq[Last][c];
    }

    Slice1[MaxClass+1] = ValFreq[x];
    Slice2[MaxClass+1] = ValFreq[y];

    ValFreq[x] += ValFreq[y];
    ValFreq[y]  = ValFreq[Last];
}



/*************************************************************************/
/*									 */
/*  Restore old class distribution figures of discrete attribute	 */
/*  values x and y from Slice1 and Slice2				 */
/*									 */
/*************************************************************************/


    Uncombine(x, y)
/*  ---------  */
    DiscrValue x, y;
{
    ClassNo c;

    ForEach(c, 0, MaxClass)
    {
	Freq[x][c] = Slice1[c];
	Freq[y][c] = Slice2[c];
    }

    ValFreq[x] = Slice1[MaxClass+1];
    ValFreq[y] = Slice2[MaxClass+1];
}



/*************************************************************************/
/*									 */
/*  Print the values of attribute Att which are in the subset Ss	 */
/*									 */
/*************************************************************************/


    PrintSubset(Att, Ss)
/*  -----------  */
    Attribute Att;
    Set Ss;
{
    DiscrValue V1;
    Boolean First=true;

    ForEach(V1, 1, MaxAttVal[Att])
    {
	if ( In(V1, Ss) )
	{
	    if ( First )
	    {
		First = false;
	    }
	    else
	    {
		printf(", ");
	    }

	    printf("%s", AttValName[Att][V1]);
	}
    }
}



/*************************************************************************/
/*									 */
/*  Construct and return a node for a test on a subset of values	 */
/*									 */
/*************************************************************************/


    SubsetTest(Node, Att)
/*  -----------  */
    Tree Node;
    Attribute Att;
{ 
    ItemCount CountItems();
    short S, Bytes;

    Sprout(Node, Subsets[Att]);

    Node->NodeType	= BrSubset;
    Node->Tested	= Att;
    Node->Errors	= 0;
    
    Bytes = (MaxAttVal[Att]>>3) + 1;
    Node->Subset = (Set *) calloc(Subsets[Att] + 1, sizeof(Set));
    ForEach(S, 1, Node->Forks)
    {
	Node->Subset[S] = (Set) malloc(Bytes);
	CopyBits(Bytes, Subset[Att][S], Node->Subset[S]);
    }
} 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99这里只有精品| 久久亚洲一级片| 久久精品人人爽人人爽| 一区二区三区中文在线| 中文乱码免费一区二区| 免费高清视频精品| 91久久精品一区二区二区| 久久网站最新地址| 无码av免费一区二区三区试看| 国产成人午夜99999| 日韩欧美激情一区| 日日夜夜一区二区| 欧美精品丝袜中出| 爽好久久久欧美精品| 欧美日韩一区三区四区| 亚洲欧洲成人自拍| 91在线视频官网| 亚洲日本在线视频观看| 丁香网亚洲国际| 精品欧美久久久| 亚洲综合在线免费观看| 中文字幕巨乱亚洲| 亚洲视频综合在线| 色综合久久88色综合天天6| 国产精品成人一区二区艾草| 99久久婷婷国产精品综合| 亚洲日本韩国一区| 在线一区二区视频| 亚洲综合清纯丝袜自拍| 6080yy午夜一二三区久久| 精品久久一二三区| 国产二区国产一区在线观看| 国产精品三级视频| 欧美日韩一区中文字幕| 久久超级碰视频| 国产精品国模大尺度视频| 色综合久久综合网欧美综合网| 亚洲一区二区三区小说| 日韩欧美你懂的| av亚洲精华国产精华| 日韩av电影天堂| 国产精品日日摸夜夜摸av| 欧美日韩高清一区| 高清免费成人av| 天天综合色天天| 亚洲桃色在线一区| 国产亚洲综合在线| 欧美一区二区三级| 色综合网色综合| 国产精品12区| 久久99国产精品麻豆| 日韩av成人高清| 亚洲在线观看免费| 亚洲免费大片在线观看| 国产精品欧美综合在线| 欧美乱妇20p| 欧洲一区二区三区免费视频| 国内精品免费**视频| 精品一区二区三区在线观看 | 岛国av在线一区| 久久精品在这里| 欧美一区二区视频观看视频 | 国产欧美一区二区精品婷婷 | 久久精品噜噜噜成人av农村| 亚洲图片有声小说| 国产精品国产三级国产普通话蜜臀 | 国产精品1024久久| 国产麻豆91精品| 成人avav在线| 国产成人精品免费一区二区| 亚洲一区二区在线免费观看视频| 国产亚洲污的网站| 国产精品青草久久| 亚洲国产日韩精品| 日本欧美在线观看| 国产精品一线二线三线| 国产电影精品久久禁18| 成人黄色大片在线观看| 国产精品自拍一区| 99久久国产综合色|国产精品| 国内精品在线播放| 国产精品毛片高清在线完整版| 色拍拍在线精品视频8848| 成人激情小说网站| 国产福利电影一区二区三区| 91在线免费看| 日韩一区二区免费在线观看| 久久久国产精品麻豆| 亚洲少妇30p| 精品一区二区免费在线观看| 成人性生交大片| 91精品国产手机| 久久亚洲综合色一区二区三区| **欧美大码日韩| 久久精品国产精品亚洲红杏| 97国产精品videossex| 日韩欧美在线一区二区三区| 亚洲女与黑人做爰| 国产乱子轮精品视频| 欧美日韩国产在线观看| 久久精品免费在线观看| 亚洲欧美激情在线| 麻豆成人av在线| 91小视频在线观看| 中文字幕一区视频| 高清不卡在线观看| 日韩午夜电影av| 日本免费新一区视频| 欧美日韩一二三| 亚洲一区免费观看| av亚洲精华国产精华精| 国产亚洲视频系列| 国产精品亚洲成人| 精品国产麻豆免费人成网站| 久久精品国产精品青草| 日本久久一区二区| 亚洲小说春色综合另类电影| a4yy欧美一区二区三区| 最新日韩av在线| 99综合电影在线视频| 亚洲男人的天堂av| 欧美亚洲国产怡红院影院| 国产精品进线69影院| 91免费精品国自产拍在线不卡| 日韩一区在线看| 欧美日韩免费一区二区三区| 天天综合色天天综合色h| 日韩视频免费直播| 国产高清精品在线| 欧美一区二区在线视频| 狠狠色2019综合网| 国产精品美女久久久久aⅴ| 94-欧美-setu| 亚洲成年人网站在线观看| 精品粉嫩超白一线天av| 粉嫩aⅴ一区二区三区四区| 《视频一区视频二区| 在线播放国产精品二区一二区四区 | 亚洲精品视频观看| 日韩一区二区免费视频| 99久久精品国产麻豆演员表| 午夜精品一区在线观看| 久久天天做天天爱综合色| 欧美亚洲国产一区在线观看网站| 国产曰批免费观看久久久| 欧美在线免费观看视频| 久久精品人人做人人爽97| 亚洲v精品v日韩v欧美v专区| 欧美丝袜丝交足nylons图片| 麻豆91在线播放| 久久毛片高清国产| 色婷婷亚洲精品| 久久国产尿小便嘘嘘| 亚洲午夜免费视频| 国产精品对白交换视频| 91精品黄色片免费大全| 色婷婷av一区| 成人h版在线观看| 国产盗摄一区二区三区| 青青草国产精品97视觉盛宴| 亚洲自拍另类综合| 成人免费在线视频| 国产精品久久久久久久久久久免费看 | 精品久久久久99| 欧美日本乱大交xxxxx| 欧美高清dvd| 欧美日韩国产一区二区三区地区| 婷婷综合久久一区二区三区| 国产精品久久久久影院亚瑟| 精品国产乱码久久久久久夜甘婷婷| 久久综合久久99| 久久国产精品露脸对白| 欧美一卡二卡在线观看| 国产日韩精品一区二区三区在线| 亚洲成人先锋电影| 久久综合久久综合九色| 91麻豆精品在线观看| 蜜臀精品久久久久久蜜臀| 中文av一区特黄| 制服丝袜亚洲色图| 粉嫩嫩av羞羞动漫久久久| 亚洲在线视频一区| 国产无人区一区二区三区| 色妞www精品视频| 九九热在线视频观看这里只有精品| 日本午夜精品一区二区三区电影| 亚洲成人av一区| 久久国产福利国产秒拍| 国产精品一区二区黑丝| 色欧美片视频在线观看在线视频| 久久婷婷国产综合精品青草| 亚洲欧洲国产日本综合| 中文字幕 久热精品 视频在线| 中文字幕中文在线不卡住| 亚洲伊人伊色伊影伊综合网| 福利电影一区二区| 69成人精品免费视频| jlzzjlzz欧美大全| 九九热在线视频观看这里只有精品| 国产精品久久久久影院色老大|