Question

I m learning to use weka for clustering problems. Usage of ARFF file seems new to me. I have a doubt for which i couldnt find a solution online from what i searched. The problem is to access a specific attribute from ARFF file. Example, My file has contents like this,

@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

And using X-Means clustering algorithm, each of the above line is taken as an instance, that is, if i say give the fourth instance, it gives

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

But what i need is to fetch one attribute alone, say "-0.286" from the above instance. I tried instance[2] but it says "object is unsubscriptable". I m totally new to this, Can anyone help me with this ?

Any help is going to be really useful.

Thanks in advance.

Was it helpful?

Solution

I have got the answer. Its "data.instance(2).value(3)"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top