Example |
VectorLib vlib=new VectorLib(); ClusteringLib clib=new ClusteringLib(); int[][] data={{20, 30}, {30, 20}, {30, 30}, {70, 70}, {80, 80}}; int[] clusters=clib.Clustering("centroid", data, 2); vlib.view("Clusters", clusters); |
Output |
clusters = 0 0 0 1 1 |
Example |
VectorLib vlib=new VectorLib(); ClusteringLib clib=new ClusteringLib(); int[][] data={{20, 30}, {30, 20}, {30, 30}, {70, 70}, {80, 80}}; int k=2; double[][] centroids=clib.initCentroid(data, k); int[] clusters=clib.Clustering("kmeans", data, k, centroids); vlib.view("Centroids", centroids); vlib.view("Clusters", clusters); |
Output |
Centroids = 24.0 22.0 71.0 66.0 Clusters = 0 0 0 1 1 |