Clustering Library (ClusteringLib)


getError
to calculate sum of squared error of clusters



FUNCTIONS

double - getError(int[] clusters, int[] label)




EXAMPLES

Example VectorLib vlib=new VectorLib();
ClusteringLib clib=new ClusteringLib();
Dataset_int dataset=new Dataset_int("ruspini", "supervised");
double[][] centroids=clib.initCentroid(dataset.data, dataset.k);
int[] clusters=clib.Clustering("kmeans", dataset.data, dataset.k);
double error=clib.getError(clusters, dataset.label);
vlib.view("Centroids awal", centroids);
vlib.view("Error", error);
Output Centroids awal =
52.0      90.0
90.0      6.0
32.0      75.0
81.0      56.0

Error = 33.333333333333336