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())); }