Creating Instances for Classification - Weka

I have a question. I have a java application that classifies instances from the real world, and I have memory in double [] [], my question is this:

Instance iExample = new Instance(4); 
iExample.setValue((Attribute)fvWekaAttributes.elementAt(0), 1.0);       
iExample.setValue((Attribute)fvWekaAttributes.elementAt(1), 0.5);       
iExample.setValue((Attribute)fvWekaAttributes.elementAt(2), "gray"); 
iExample.setValue((Attribute)fvWekaAttributes.elementAt(3), "positive"); 

This is an example given to create an instance, but since I classify the instance, does it need the last element (3-ClassAtribute), which is the class that I want to mark / predict? What have I set? Empty line?

iExample.setValue((Attribute)fvWekaAttributes.elementAt(3), "");   

I want to be able to label an instance and get a distribution, for example.

Thanks in advance

Js

+3
source share
1 answer

You can set the attribute value to Instancefor undefined use withmyInstance.setMissing(int attributeIndex)

+3
source

All Articles