/// <summary> /// Test the clustering of data in an Array /// </summary> private static void ClusterDataSetTestCase() { double[][] data = DataSample.GetDataSampleFromFile(10000, 25); ClusterCollection clusters; clusters = new KdKMeans().ClusterDataSet(5, data); //This line has been commented out. Uncomment it to serialize your object(s) KdKMeans.Serialize(clusters, @"kmeansclusters.xml"); }
/// <summary> /// Test the Cluster Mean calculation between two data points /// </summary> private static void ClusterMean() { double [] John = new double[] {20, 170, 80}; double [] Henry = new double[] {30, 160, 120}; double[][] cluster = new double[2][]; cluster[0] = John; cluster[1] = Henry; double [] centroid = new KdKMeans().ClusterMean(cluster); //((20+30)/2), ((170+160)/2), ((80+120)/2) System.Diagnostics.Debug.WriteLine(centroid.ToString()); }
/// <summary> /// Test the Manhattan Distance calculation between two data points /// </summary> private static void ManhattanDistanceTest() { double [] John = new double[] {20, 170, 80}; double [] Henry = new double[] {30, 160, 120}; double distance = new KdKMeans().ManhattanDistance(John, Henry); System.Diagnostics.Debug.WriteLine(distance); }