private void button1_Click_1(object sender, EventArgs e)
        {
            chart1.Series.Clear();
            Dictionary <int, UserForKMeansWine> users   = Clustering.parseintousers(textBoxFilename.Text);
            Tuple <float, List <Cluster> >      results = Clustering.kmeans((int)numericUpDown2.Value, (int)numericUpDown1.Value, users);
            int currentcluster = 1;

            foreach (Cluster cluster in results.Item2)
            {
                string clustername = "cluster " + currentcluster;

                chart1.Series.Add(clustername);

                cluster.countamountofoffers().ToList().ForEach(x => chart1.Series[clustername].Points.AddY(x));
                string[] views = cluster.listofclustermember();
                listView1.Items.Add("Cluster " + currentcluster + ":");
                foreach (string view in views)
                {
                    listView1.Items.Add("user " + view + " part of cluster " + currentcluster);
                }


                currentcluster++;
            }
        }
 public float distancebetweenthisanduser(UserForKMeansWine user2)
 {
     float[] set1 = new float[32];
     float[] set2 = new float[32];
     foreach (KeyValuePair <int, Boolean> transaction in transactions)
     {
         set1[transaction.Key] = Convert.ToInt16(transactions[transaction.Key]);
         set2[transaction.Key] = Convert.ToInt16(user2.transactions[transaction.Key]);
     }
     return(Clustering.calculateEuclidianDistance(set1, set2));
 }
 private void button1_Click_2(object sender, EventArgs e)
 {
     float[] set1 = { 6f, 4f };
     float[] set2 = { 3f, 8f };
     listView1.Items.Add(new ListViewItem(Clustering.calculateEuclidianDistance(set1, set2).ToString()));
 }