Weka:Clusteriod返回的1-d数据不是2-d?

时间:2014-12-18 05:54:05

标签: java weka

我有以下csv文件:

enter image description here

然而,我收到了以下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);
}

0 个答案:

没有答案