Weka Linear regression ClassNotFoundException

2019-07-17 14:15发布

String filePath = new File("").getAbsolutePath();
DataSource source = new DataSource(filePath + "\\src\\data\\data.arff");
Instances dataset = source.getDataSet();
// set class
dataset.setClassIndex(0);

// build model
**LinearRegression lr = new LinearRegression();**
lr.buildClassifier(dataset);
System.out.println(lr);

Right after LinearRegression instantiation I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix at weka_prediction.Main_LinearRegression.main(Main_LinearRegression.java:22) Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more

I am using weka 3.8.

any ideas? thanks in advance

标签: weka
2条回答
唯我独甜
2楼-- · 2019-07-17 14:41

There is a problem with loading weka.core. You just need to go to the weka repository and download and add the following jars:

  • mtj.jar
  • arpack_combined_all.jar
  • core.jar

See more details here:

查看更多
Juvenile、少年°
3楼-- · 2019-07-17 14:43
登录 后发表回答