Error creating Weka instance object

I was looking for a Weka programming example from http://weka.wikispaces.com/Programmatic+Use . However, I think that due to the version of my Weka jar (3.7.7) it gives an error in this line:

Instance iExample = new Instance(4); Error: Cannot instantiate the type Instance 

What change should I make in the code?

+8
java weka
source share
1 answer

Well, according to this documentation Instance is an interface. That is why you get this error. You will need to create one of the implementation classes, for example

 Instance iExample = new DenseInstance(4); 

Perhaps this example is out of date.

+14
source share

All Articles