Weka Linear regression ClassNotFoundException

╄→尐↘猪︶ㄣ 提交于 2019-12-11 01:14:26

问题


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


回答1:


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:




回答2:


Solved! instead of 3.8, I am now using 3.6 from here: http://grepcode.com/project/repo1.maven.org/maven2/nz.ac.waikato.cms.weka/weka-stable/



来源:https://stackoverflow.com/questions/42178995/weka-linear-regression-classnotfoundexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!