我有以下csv文件:
然而,我收到了以下clusteriod响应:
Value for class1 centroid 0: -5.862958158866699
正如你可以看到它是一个数字,我期待两个数字,因为csv文件已满2维元素。
以下是获取clusteriod的代码(此代码来自wekas主页):
Instances instances = kmeans.getClusterCentroids();
for (int i = 0; i < instances.numInstances(); i++) {
// for each cluster center
Instance inst = instances.instance(i);
// as you mentioned, you only had 1 attribute
// but you can iterate through the different attributes
double value = inst.value(0);
System.out.println("Value for class1 centroid " + i + ": " + value);
}