正在加载图片...
数据挖掘论文 double randomTempAge= Math. Pow (randomAge-cluserRow Age Value, 2) double random TempHeight Math Pow (randomHeight cluserRow. Height Value, 2) double randomTempWeight Math Pow (randomWeight Value, 2) double randomDistance Math Sart (random TempAge randomTempHeight randomTempWeight) orgCount + orgDistance: randomCount + randomDistance //得到交换后它们的代价 sub randomCount - orgCount (5)核心函数k中心点算法函数体内调用了上面的函数 7//<summary> ///k中心点算法 7//</summary) //< param name="k">分成k簇</ param> //< param name=" OrgionListstaff">原数据</ param> /// <returns></returns public List<Staff> K method (int k, List<Staff> OrgionListStaff) /初始化总代价 double s =0 //判断是否所有的中心点不在变化标志 bool Changed true /初始化一个随机数生成器 Random ccy new Random o //得到所有数据的个数 int count OrgionListStaff Count //初始化整个数据变化后保存的链表集合 List<Staff> ChangedListStaff new List<Staff>o //初始化k个中心点保存链表集合 List<staff> CentainPoint this InitCentainPoint(k, OrgionListStaff ChangedListStaff) while(Changed) //指派每个剩余的对象给离它最近的中心点所代表的簇 ChangedListStaff this. SetClusterList(k, OrgionListStaff CentainPoint //得到原始的中心点集合 List<staff> firstCentainPoint CentainPoint 6数据挖掘论文 6 double randomTempAge = Math.Pow(randomAge - cluserRow.Age.Value, 2); double randomTempHeight = Math.Pow(randomHeight - cluserRow.Height.Value, 2); double randomTempWeight = Math.Pow(randomWeight - cluserRow.Weight.Value, 2); double randomDistance = Math.Sqrt(randomTempAge + randomTempHeight + randomTempWeight); orgCount += orgDistance; randomCount += randomDistance; } //得到交换后它们的代价 sub = randomCount - orgCount; return sub; } (5) 核心函数 k 中心点算法(函数体内调用了上面的函数) /// <summary> /// k中心点算法 /// </summary> /// <param name="k">分成k簇</param> /// <param name="OrgionListStaff">原数据</param> /// <returns></returns> public List<Staff> K_method(int k, List<Staff> OrgionListStaff) { //初始化总代价 double s = 0; //判断是否所有的中心点不在变化标志 bool Changed = true; //初始化一个随机数生成器 Random ccy = new Random(); //得到所有数据的个数 int count = OrgionListStaff.Count; //初始化整个数据变化后保存的链表集合 List<Staff> ChangedListStaff = new List<Staff>(); //初始化k个中心点保存链表集合 List<Staff> CentainPoint = this.InitCentainPoint(k, OrgionListStaff, out ChangedListStaff); while (Changed) { //指派每个剩余的对象给离它最近的中心点所代表的簇 ChangedListStaff = this.SetClusterList(k, OrgionListStaff, CentainPoint); //得到原始的中心点集合 List<Staff> FirstCentainPoint = CentainPoint;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有