从ARFF文件访问特定属性

时间:2014-02-21 05:40:31

标签: machine-learning jython weka arff

我正在学习使用weka来解决群集问题。 ARFF文件的使用对我来说似乎不太新鲜。我有一个疑问,我无法在网上找到我搜索的解决方案。问题是从ARFF文件访问特定属性。 例, 我的文件包含这样的内容,

@relation whatever

@attribute Latitude numeric
@attribute Longitude numeric
@attribute NoOfEmp numeric
@attribute Revenue numeric
@attribute Type4 numeric
@attribute Type6 numeric
@attribute Type7 numeric
@attribute Type8 numeric
@attribute Type9 numeric
@attribute Type10 numeric
@attribute Type11 numeric

@data
0.456,0.029,-0.143,-0.143,1,0,0,0,0,0,0
0.443,0.032,-0.286,-0.286,1,0,0,0,0,0,0
0.487,0.012,-0.286,-0.286,1,0,0,0,0,0,0
0.435,0.027,-0.286,-0.286,1,0,0,0,0,0,0
0.467,-0.01,-0.143,-0.143,1,0,0,0,0,0,0
0.484,0.007,-0.286,-0.286,1,0,0,0,0,0,0
0.456,0.029,-0.286,-0.286,1,0,0,0,0,0,0
0.457,0.032,0.286,0.286,0,0,1,0,0,0,0
0.486,-0.019,0.286,0.286,0,0,1,0,0,0,0

使用X-Means聚类算法,上面的每一行都被视为一个实例,也就是说,如果我说给第四个实例,它给出了

0.435,0.027,-0.286,-0.286,1,0,0,0,0,0,0

但我需要的是单独获取一个属性,从上面的实例中说“-0.286”。我尝试了实例[2],但它说“对象是不可取消的”。我对此非常陌生,任何人都可以帮助我吗?

任何帮助都会非常有用。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我得到了答案。其"data.instance(2).value(3)"