Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to instantiate a Weka class in MATLAB

I'm trying to convert data X in MATLAB into a Weka Instance class. I'm using Weka 3.7.5 and MATLAB 7.10 (2010a).

I've tried the following:

javaaddpath([WEKA_HOME 'weka.jar']);
import weka.core.*;

N = 3;
inst = Instance( N );

And I receive the error

??? No constructor 'weka.core.Instance' with matching signature found. 

When I type which Instance, it is able to find this class. Also, this form of the constructor agrees with the one documented here.

I'm inexperienced with calling Java from MATLAB, so it's likely I'm missing something simple here. Thanks!

Updates:

  1. Tried casting N to an int32, but no luck, still same error.

  2. I tried this with an older version of Weka ( ver 3.5.8 ) and it worked. Can't explain why though.

  3. I found updated documentation : which tells me that Instance is now an interface rather than a class like it was in the documentation I was looking at. So I guess my question is now, can I instantiate this like I do a class? Sorry for confusing this initially..

like image 833
MarkV Avatar asked Nov 30 '25 17:11

MarkV


1 Answers

Use class DenseInstance instead of Instance. It's an implementation of the Interface in 3.6.

like image 171
Caveman Avatar answered Dec 03 '25 07:12

Caveman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!