// K-Means private void Kmeans(Dictionary <int, Dictionary <int, double> > data, int clusters, string type, string codage) { double[,] db = null; if (data.Count > 1) { if (codage != "Binaire") { db = convertData(data); } else { db = convertDataBin(data); } } else { return; } Console.WriteLine("Donnees convertie"); cluster = KMeans.ClusterDataSet(clusters, db, type); //MessageBox.Show(this,"Nombre de cluster : " + cluster.Count); Console.WriteLine("Kmeans calcule"); //Dictionary<int, int> stationCluster = new Dictionary<int, int>(); stationCluster = new Dictionary <int, int>(); for (int i = 0; i < cluster.Count; i++) { Console.WriteLine("Cluster : " + i + " - Taille : " + cluster[i].Count); //string s = "Cluster " + i + ", taille = " + cluster[i].getValues.Count + " : "; foreach (int z in cluster[i].getValues) { //Console.WriteLine(stations[z]); int temp = stations[z]; stationCluster.Add(temp, i); //string s = stations[z] + " : " + i ; } } ScrollableMaps maps = new ScrollableMaps(); maps.drawClusters(stationCluster); PictureBox map = maps.mapBox; map.SizeMode = PictureBoxSizeMode.Zoom; map.Dock = DockStyle.Fill; Panel tempPanel = new Panel(); tempPanel.Dock = DockStyle.Fill; combo1 = new ComboBox(); combo1.Text = "Affichage des statistiques pour les clusters"; combo1.Items.Add("Tous les clusters"); combo1.Items.Add("Altitudes"); combo1.Items.Add("Point of Interest"); for (int i = 0; i < cluster.Count; i++) { combo1.Items.Add(i); } combo1.SelectedIndexChanged += changeCluster; combo1.Dock = DockStyle.Top; tempPanel.Controls.Add(combo1); tempPanel.Controls.Add(map); panel.addControls(tempPanel); }