I am using weka kmeans classifier and i have build it a model.Now i want to cluster center value of each centroid.
I get it on weka UI
Attribute Full Data 0 1
(48836) (39469) (9367)
============================================
tt 428.6238 514.1345 68.3143
How can i get it using weka java jar?
My weka cluster training set has only one attribute.
To get attribute name i do:
String attname =clusterCenters.get(0).attribute(0).name();
How to get value of cluster center?
When you call to the method
getClusterCentroids()inSimpleKMeansyou get anInstancesobject (in weka-3-6-8). This is a set of instances that represent your cluster centers (one for each specified cluster).Once we have the set of instances (centroids), we can guess its size by
numInstances(), iterate through them usinginstance(int index)and getting their values withdouble value(int attIndex)this way:And that is all.
I have not compiled the code, but that is the way I do it.