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

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

?? cftree.c

?? 數據挖掘算法BIRCH源碼 c語言版本。
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************File Name:   cftree.CAuthor: Tian Zhang, CS Dept., Univ. of Wisconsin-Madison, 1995               Copyright(c) 1995 by Tian Zhang                   All Rights ReservedPermission to use, copy and modify this software must be grantedby the author and provided that the above copyright notice appear in all relevant copies and that both that copyright notice and this permission notice appear in all relevant supporting documentations. Comments and additions may be sent the author at zhang@cs.wisc.edu.******************************************************************/#include "global.h"#include "util.h"#include "vector.h"#include "rectangle.h"#include "cfentry.h"#include "cutil.h"#include "status.h"#include "contree.h"#include "cftree.h"#include "path.h"int Node::N() const {	int tmp = 0;	for (int i=0; i<actsize; i++) 		tmp+=entry[i].n;	return tmp;}	void Node::SX(Vector& tmpsx) const {	tmpsx.Reset();	for (int i=0; i<actsize; i++)		tmpsx+=entry[i].sx;	}double Node::SXX() const {	double tmp=0;	for (int i=0; i<actsize; i++) 		tmp+=entry[i].sxx;	return tmp;}void Node::CF(Entry& tmpcf) const {	tmpcf.Reset();	for (int i=0; i<actsize; i++)		tmpcf+=entry[i];	}double Node::Radius() const {	Entry tmpent;	tmpent.Init(entry[0].sx.dim);	this->CF(tmpent);	return tmpent.Radius();	}double Node::Diameter() const {	Entry tmpent;	tmpent.Init(entry[0].sx.dim);	this->CF(tmpent);	return tmpent.Diameter();	}double Node::Fitness(short ftype) const {	Entry tmpent;	tmpent.Init(entry[0].sx.dim);	this->CF(tmpent);	return tmpent.Fitness(ftype);	}#ifdef RECTANGLEvoid Node::Rect(Rectangle& tmprect) const {	tmprect.Reset();	for (int i=0; i<actsize; i++)		tmprect+=entry[i].rect;	}#endif RECTANGLEdouble Leaf::AbsVofLevel(int i, short ftype, short dim) const {if (i>0) print_error("Leaf::AbsVofLevel","can not go further");if (i==0) return pow(sqrt(this->Fitness(ftype)),dim);}double Nonleaf::AbsVofLevel(int i, short ftype, short dim) const {double AbsV=0.0;if (i>Depth()-1) print_error("Nonleaf::AbsVofLevel","can not go further"); if (i==0) return pow(sqrt(this->Fitness(ftype)),dim);else { for (int j=0; j<actsize; j++) 	AbsV+=child[j]->AbsVofLevel(i-1,ftype,dim);       return AbsV;       }}int Leaf::Size() const { return 1; }int Nonleaf::Size() const {	int size=1;	for (int i=0; i<actsize; i++) 		size+=child[i]->Size();	return size;}int Leaf::Depth() const { return 1; }int Nonleaf::Depth() const {	if (actsize==0) return 1;         else return 1+child[0]->Depth();	}int Leaf::LeafNum() const { return 1; }int Nonleaf::LeafNum() const {	int num=0;	for (int i=0; i<actsize; i++) 		num+=child[i]->LeafNum();	return num;}int Leaf::NonleafNum() const { return 0; }int Nonleaf::NonleafNum() const {	int num=1;	for (int i=0; i<actsize; i++)		num+=child[i]->NonleafNum();	return num;}int Leaf::NumLeafEntry() const { return actsize; }int Leaf::NumNonleafEntry() const { return 0; }int Nonleaf::NumLeafEntry() const {	int tmpn = 0;	for (int i=0; i<actsize; i++)		tmpn+=child[i]->NumLeafEntry();	return tmpn;	}int Nonleaf::NumNonleafEntry() const {	int tmpn = actsize;	for (int i=0; i<actsize; i++)		tmpn+=child[i]->NumNonleafEntry();	return tmpn;	}int Leaf::NumEntry() const{ return actsize; }int Nonleaf::NumEntry() const {	int tmpn = actsize;	for (int i=0; i<actsize; i++) 		tmpn+=child[i]->NumEntry();	return tmpn;}double Leaf::Occupancy(Stat *Stats) const {	return actsize/(1.0*MaxSize(Stats));}double Nonleaf::Occupancy(Stat *Stats) const {	int leafsize, nonleafsize;#ifdef RECTANGLE	leafsize=(Stats->PageSize-2*sizeof(int))/		 (sizeof(int)+sizeof(double)*(3*Stats->Dimension+1));#else 	leafsize=(Stats->PageSize-2*sizeof(int))/		 (sizeof(int)+sizeof(double)*(Stats->Dimension+1));#endif	nonleafsize=MaxSize(Stats);	return NumEntry()/(1.0*nonleafsize*NonleafNum()+1.0*leafsize*LeafNum());}void Node::Print_Summary(Stat *Stats, ostream &fo) const {Entry tmpent;tmpent.Init(entry[0].sx.dim);CF(tmpent);fo<<"Root CF\t"<<tmpent<<endl;fo<<"FootPrint\t"<<sqrt(tmpent.Radius())<<endl;#ifdef RECTANGLERectangle tmprect;tmprect.Init(entry[0].sx.dim);Rect(tmprect);fo<<"Root Rectangle\t"<<tmprect<<endl;#endif RECTANGLEfo<<"Leaf Nodes\t"<<LeafNum()<<endl;fo<<"Nonleaf Nodes\t"<<NonleafNum()<<endl;fo<<"Tree Size\t"<<Size()<<endl;fo<<"Tree Depth\t"<<Depth()<<endl;fo<<"Leaf Entries\t"<<NumLeafEntry()<<endl;fo<<"Nonleaf Entries\t"<<NumNonleafEntry()<< endl;fo<<"Occupancy\t"<<Occupancy(Stats)<<endl;}void Node::Print_Summary(Stat *Stats, ofstream &fo) const {Entry tmpent;tmpent.Init(entry[0].sx.dim);CF(tmpent);fo<<"Root CF\t"<<tmpent<<endl;fo<<"FootPrint\t"<<sqrt(tmpent.Radius())<<endl;#ifdef RECTANGLERectangle tmprect;tmprect.Init(entry[0].sx.dim);Rect(tmprect);fo<<"Root Rectangle\t"<<tmprect<<endl;#endif RECTANGLEfo<<"Leaf Nodes\t"<<LeafNum()<<endl;fo<<"Nonleaf Nodes\t"<<NonleafNum()<<endl;fo<<"Tree Size\t"<<Size()<<endl;fo<<"Tree Depth\t"<<Depth()<<endl;fo<<"Leaf Entries\t"<<NumLeafEntry()<<endl;fo<<"Nonleaf Entries\t"<<NumNonleafEntry()<< endl;fo<<"Occupancy\t"<<Occupancy(Stats)<<endl;}Node* Leaf::DenseNode(){if (actsize>1) return this;else return NULL;}short Leaf::FreeEmptyNode(Stat *Stats){short flag=TRUE;for (int i=0; i<actsize; i++) 	if (entry[i].n>0) {flag=FALSE; break;}if (flag==TRUE) {	this->AssignNextPrev(Stats); 	delete this; 	Stats->MemUsed--; 	Stats->TreeSize--;	}return flag;}// fit without expanding or splittingshort Leaf::BestFitPath1(Stat *Stats, const Entry &ent, Path& BestPath){int EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	BestPath.Push(EntryI,this);	return TRUE;	}else return FALSE;}// fit with expanding but without splittingshort Leaf::BestFitPath2(Stat *Stats, const Entry &ent, Path& BestPath){int EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	BestPath.Push(EntryI,this);	return TRUE;	}else if (actsize<MaxSize(Stats)) {	BestPath.Push(actsize,this);	return TRUE;	}else return FALSE;}// absorb without expanding and splittingshort Leaf::AbsorbEntry1(Stat *Stats, const Entry &ent){int EntryI;EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	entry[EntryI]+=ent;	return TRUE;	}else return FALSE;}// absorb with expanding but without splittingshort Leaf::AbsorbEntry2(Stat *Stats, const Entry &ent){int EntryI;EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	entry[EntryI]+=ent;	return TRUE;	}else if (actsize<MaxSize(Stats)) {	entry[actsize]=ent;	actsize++; 	Stats->CurrEntryCnt++;	return TRUE;	}     else return FALSE;}ConNode* Leaf::Copy(Stat *Stats) const{ConNode* node=new ConNode(actsize,Stats);for (int i=0; i<actsize; i++) node->entry[i]=entry[i];return node;}ConNode* Nonleaf::Copy(Stat *Stats) const{ConNode* node=new ConNode(actsize,Stats);for (int i=0; i<actsize; i++) {	node->entry[i]=entry[i];	node->child[i]=child[i]->Copy(Stats);	}return node;}Node* Leaf::AdjustTree(Stat *Stats, const Entry &ent) {int  EntryI;Node *NewNode;if (actsize==0) {	entry[actsize]=ent;	actsize++; 	Stats->CurrEntryCnt++;	return NULL;	}EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	entry[EntryI]+=ent;	return NULL;	}else {	NewNode = InsertMightSplit(Stats,ent,NULL);	if (NewNode==NULL) return NULL;	else {		if (this!=Stats->OldRoot)			return NewNode;		else {  Stats->CreateNewRoot(this,NewNode);			return NULL;	             }             }	}}Node* Nonleaf::DenseNode(){Node *tmp;// less than 2 entries: this->N()<=1||this->actsize<=1 if (this->N()<=1) return NULL;if (this->actsize<=1) {	tmp = child[0]->DenseNode();	if (tmp==NULL) return NULL;	else return tmp;	}// more than 2 entries: this->N()>1&&this->actsize>1int EntryI = DensestEntry();tmp=child[EntryI]->DenseNode();if (tmp==NULL) return this;else return tmp;}short Nonleaf::FreeEmptyNode(Stat *Stats){short flag=TRUE;int i=0;while (i<actsize) {	if (child[i]->FreeEmptyNode(Stats)==TRUE) {		actsize--;		entry[i]=entry[actsize];		child[i]=child[actsize];		}	else {  flag=FALSE;		i++;		}	}if (flag==TRUE) {	delete this; 	Stats->MemUsed--; 	Stats->TreeSize--;	}return flag;}		// fit without expanding and splittingshort Nonleaf::BestFitPath1(Stat *Stats, const Entry &ent, Path& BestPath){int EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	BestPath.Push(EntryI,this);		if (child[EntryI]->BestFitPath1(Stats,ent,BestPath)==TRUE) 		return TRUE;	else 	return FALSE;	}else return FALSE;}// fit with expanding but without splittingshort Nonleaf::BestFitPath2(Stat *Stats, const Entry &ent, Path& BestPath){int EntryI=ClosestOne(Stats,ent);if (EntryI>=0) {	BestPath.Push(EntryI,this);		if (child[EntryI]->BestFitPath2(Stats,ent,BestPath)==TRUE) 		return TRUE;	else 	return FALSE;	}else return FALSE;}// absorb without expanding and splittingshort Nonleaf::AbsorbEntry1(Stat *Stats, const Entry &ent){int EntryI;EntryI = ClosestOne(Stats,ent);if (child[EntryI]->AbsorbEntry1(Stats,ent)==TRUE) {	entry[EntryI]+=ent;	return TRUE;	}else return FALSE;}// absorb with expanding but without splittingshort Nonleaf::AbsorbEntry2(Stat *Stats, const Entry &ent){int EntryI;EntryI=ClosestOne(Stats,ent);if (child[EntryI]->AbsorbEntry2(Stats,ent)==TRUE) {	entry[EntryI]+=ent;	return TRUE;	}else return FALSE;}Node* Nonleaf::AdjustTree(Stat *Stats, const Entry &ent){int EntryI;int i,j;double d;Node *ResNode, *NewNode;Entry ResEnt;ResEnt.Init(Stats->Dimension);EntryI=ClosestOne(Stats,ent);ResNode=child[EntryI]->AdjustTree(Stats,ent);if (ResNode!=NULL) { // Split Propagate	child[EntryI]->CF(entry[EntryI]);	ResNode->CF(ResEnt);	NewNode=InsertMightSplit(Stats,ResEnt,ResNode); 	if (NewNode==NULL) { // Split Propagate Stops	   if (actsize>2) {		d=ClosestTwo(Stats, i, j);		if (!(i==EntryI&&j==actsize-1))	       		MergeMightResplit(Stats, i, j);		}	  return NULL;	  }	 else { if (this!=Stats->OldRoot) 			return NewNode;	        else { // Create New Root	  		Stats->CreateNewRoot(this,NewNode);	  		return NULL;	        	}              }	}else { // No Split Coming Up	entry[EntryI]+=ent; 	return NULL;	}}int Nonleaf::DensestEntry() const{int i, imax, nmax;imax = 0;nmax = entry[0].n;for (i=1; i<actsize; i++) {	if (entry[i].n>nmax) {		imax = i;		nmax = entry[i].n;		}	}return imax;}int Nonleaf::ClosestOne(Stat *Stats, const Entry& ent) const {int i, imin;double d, dmin;// empty nodeif (actsize<=1) return 0;// nonemptry nodeimin = 0;dmin = HUGE_DOUBLE;for (i=0; i<actsize; i++) {    if (entry[i].n>0) {	d = distance(Stats->BDtype,entry[i],ent);	if (d<dmin) {dmin=d;imin=i;}	}    }if (dmin<HUGE_DOUBLE) return imin;else return -1;}int Leaf::DensestEntry() const{// do nothing and never be called.}int Leaf::ClosestOne(Stat *Stats, const Entry& ent) const {int i, imin;double d, dmin;// empty nodeif (actsize<1) return 0;// nonempty nodeimin = 0;dmin = HUGE_DOUBLE;/***************************************************// option1: min average D: tend to cause overlapping for (i=0; i<actsize; i++) {    if (entry[i].n>0) {	d = fitness(Stats->Ftype,entry[i],ent);	if (d<dmin) {		dmin=d;		imin=i;		}	}    }if (dmin<=Stats->CurFt+PRECISION_ERROR) return imin;else return -1;***************************************************/// option2: min average Di: less overlappingfor (i=0; i<actsize; i++) {    if (entry[i].n>0) {	d = distance(Stats->BDtype,entry[i],ent);	if (d<dmin) {		dmin=d;		imin=i;		}	}    }if (dmin<HUGE_DOUBLE) {	dmin = fitness(Stats->Ftype,entry[imin],ent);        if (dmin<=Stats->CurFt+PRECISION_ERROR) return imin;        else return -1;	}else return -1;}double Leaf::ClosestTwo(Stat *Stats, int &i, int &j) const {int i1,j1,imin,jmin;double d, dmin;if (actsize<2) 	print_error("Leaf::ClosestTwo","Less than 2 entries");if (actsize==2) {	i=0; j=1; 	return distance(Stats->BDtype,entry[0],entry[1]);	}imin = 0; jmin = 1;dmin = distance(Stats->BDtype,entry[0],entry[1]);for (i1=0;i1<actsize-1;i1++)   for (j1=i1+1;j1<actsize;j1++) {		d = distance(Stats->BDtype,entry[i1],entry[j1]);		if (d<dmin) { 			imin = i1; 			jmin = j1; 			dmin = d;			}	}i=imin; j=jmin;return dmin;}// only relevant to phase 3 and hierarchical clusteringdouble Leaf::ClosestDiffTwo(Stat *Stats, int &i, int &j) const {Entry tmpent;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产91久久久久久一区二区 | 欧美一区二区三区四区视频| 黄网站免费久久| 亚洲视频电影在线| 精品国产免费一区二区三区四区 | 欧美高清视频不卡网| 国产成人精品一区二区三区四区| 一区二区三区蜜桃网| 久久久蜜桃精品| 在线播放一区二区三区| 99精品视频在线观看免费| 精品在线视频一区| 偷偷要91色婷婷| 亚洲人精品午夜| 欧美经典一区二区| 欧美电影免费观看高清完整版在线| 91热门视频在线观看| 国产精品69毛片高清亚洲| 奇米在线7777在线精品| 亚洲综合色视频| 国产精品久久久久四虎| 久久人人爽爽爽人久久久| 91精品国产品国语在线不卡| 欧美性生活久久| 一本色道久久综合亚洲精品按摩| 粉嫩一区二区三区在线看| 久久爱www久久做| 日韩一区欧美二区| 亚洲国产精品精华液网站| 亚洲日本韩国一区| 国产精品毛片高清在线完整版| 久久影院午夜片一区| 精品国产一区二区在线观看| 欧美一区二区女人| 日韩毛片在线免费观看| 国产视频一区二区三区在线观看| 日韩精品一区二区三区在线观看 | 欧美哺乳videos| 日韩丝袜美女视频| 日韩一区二区在线看| 51精品视频一区二区三区| 欧美日韩综合一区| 欧美日韩中文字幕精品| 色婷婷精品久久二区二区蜜臂av| 一本色道久久加勒比精品| 蜜桃久久久久久| 久久久激情视频| 久久噜噜亚洲综合| 亚洲精品一区二区三区99| 69久久99精品久久久久婷婷 | 久久久久久97三级| 777a∨成人精品桃花网| 久久久久久影视| 久久精品人人做人人爽人人| 亚洲永久免费av| 亚洲sss视频在线视频| 天天影视色香欲综合网老头| 蜜臀av性久久久久蜜臀av麻豆| 久久精品国产99国产| 国产一区激情在线| 97久久超碰国产精品| 91高清视频免费看| 6080国产精品一区二区| 精品国精品国产尤物美女| 久久久久久久久99精品| 中文字幕一区av| 亚洲一区二区高清| 另类综合日韩欧美亚洲| 国产精品一卡二卡| 91久久精品日日躁夜夜躁欧美| 欧美日韩mp4| 国产日韩欧美制服另类| 亚洲同性gay激情无套| 午夜激情一区二区| 美女视频免费一区| av一区二区三区黑人| 在线成人免费视频| 久久综合久久久久88| 日韩毛片视频在线看| 欧美aaa在线| 成人网页在线观看| 欧美日韩国产天堂| 久久久久国产精品免费免费搜索| 亚洲另类春色校园小说| 美女视频免费一区| 99精品黄色片免费大全| 欧美日韩精品一二三区| 中文字幕第一区第二区| 亚洲大尺度视频在线观看| 国产精品一区二区三区四区| 在线观看视频一区二区欧美日韩| 欧美岛国在线观看| 一区二区三区在线视频观看58| 日本欧美加勒比视频| 91丝袜美女网| 精品国产乱码久久久久久闺蜜| 一区二区三区四区中文字幕| 看电影不卡的网站| 色噜噜狠狠色综合中国| 久久九九久久九九| 婷婷亚洲久悠悠色悠在线播放| 粉嫩av一区二区三区| 3atv在线一区二区三区| 日韩美女精品在线| 国产成人免费高清| 日韩一卡二卡三卡四卡| 一个色在线综合| 韩国欧美国产一区| 国产一区在线精品| 91国产福利在线| 国产精品日韩成人| 久久精品99国产国产精| 91久久奴性调教| 国产精品久久毛片a| 麻豆久久久久久| 欧美视频一区二区| 精品在线你懂的| 在线综合视频播放| 亚洲一级电影视频| 91香蕉视频mp4| 中文av字幕一区| 国产乱国产乱300精品| 日韩欧美在线不卡| 婷婷国产在线综合| 欧美性大战久久久久久久| 亚洲人成小说网站色在线| 国产成人免费视频精品含羞草妖精 | 欧美日韩精品福利| 夜夜操天天操亚洲| 91视频精品在这里| ㊣最新国产の精品bt伙计久久| 国产超碰在线一区| 久久久国产精华| 国产成人在线免费| 国产日韩av一区| 成人免费视频caoporn| 国产欧美日韩综合| 成人免费视频免费观看| 国产精品视频第一区| 懂色av一区二区夜夜嗨| 国产女主播视频一区二区| 国产jizzjizz一区二区| 国产精品欧美一级免费| 99久久精品99国产精品| 亚洲美女视频在线观看| 在线亚洲+欧美+日本专区| 亚洲影视在线播放| 欧美老肥妇做.爰bbww| 天堂一区二区在线| 欧美www视频| 国产精品自在欧美一区| 国产精品午夜在线观看| 99re免费视频精品全部| 亚洲一区二区三区四区五区黄| 欧美日韩在线电影| 久久精品国产亚洲a| 久久综合精品国产一区二区三区| 成人综合在线网站| 亚洲激情中文1区| 欧美妇女性影城| 国产一区二区三区黄视频 | 狠狠狠色丁香婷婷综合激情| 久久天天做天天爱综合色| 成人免费福利片| 亚洲日本在线观看| 3d成人动漫网站| 国产精品一区二区久久不卡| 亚洲精品欧美激情| 91精品国产欧美一区二区成人| 激情综合网av| 日韩美女精品在线| 91精品国产入口| 成人激情黄色小说| 亚洲超丰满肉感bbw| 26uuu精品一区二区在线观看| 盗摄精品av一区二区三区| 亚洲第一电影网| 国产网红主播福利一区二区| 在线免费观看日韩欧美| 欧美日韩aaa| 国产成人av一区二区三区在线| 亚洲精品视频在线| 精品国产乱码久久久久久久 | 亚洲欧美日韩人成在线播放| 欧美日韩国产bt| 福利一区二区在线| 婷婷夜色潮精品综合在线| 欧美韩国日本综合| 欧美一级生活片| av中文字幕一区| 精品在线观看视频| 亚洲一区国产视频| 国产拍欧美日韩视频二区| 欧美日韩国产123区| 99国产精品久久久久久久久久| 日本不卡在线视频| 又紧又大又爽精品一区二区| 久久久久久亚洲综合影院红桃 | 欧洲色大大久久| 高清免费成人av|