Пример #1
0
 private void voBtnKMedoid_Click(object sender, EventArgs e)
 {
     try
     {
         // define distance function
         Func <Point, Point, double> koEuclidean = (a, b) => Math.Sqrt(Math.Pow((a.X - b.X), 2) + Math.Pow((a.Y - b.Y), 2));
         this.voKM = new KMedoid <Point>(koEuclidean);
         int kiK = int.Parse(this.voTbK.Text);
         this.voKM.MCompute(kiK, this.voPList);
         Visualization.MDrawClusters(this.voPB, this.voPList, this.voKM.VoClusters, kiK,
                                     this.voKM.VdMedoids.ToList( ), 0.7);
         this.voTbResult.Text = mComputeAndShowVarianceResults(kiK);
     }
     catch (Exception koEx)
     {
         MessageBox.Show(koEx.Message);
     }
 }
Пример #2
0
 private void voBtnRedraw_Click(object sender, EventArgs e)
 {
     Visualization.MDrawClusters(this.voPB, this.voPList, this.voKM.VoClusters,
                                 int.Parse(this.voTbK.Text), this.voKM.VdMedoids.ToList( ), 0.5);
 }