Weka 线性回归 ClassNotFoundException [英] Weka Linear regression ClassNotFoundException
问题描述
String filePath = new File("").getAbsolutePath();DataSource source = new DataSource(filePath + "\\src\\data\\data.arff");实例数据集 = source.getDataSet();//设置类数据集.setClassIndex(0);//构建模型**线性回归 lr = 新线性回归();**lr.buildClassifier(数据集);System.out.println(lr);
在 LinearRegression 实例化之后,我收到此错误:
<块引用>线程main"中的异常java.lang.NoClassDefFoundError:no/uib/cipr/matrix/Matrix atweka_prediction.Main_LinearRegression.main(Main_LinearRegression.java:22)引起:java.lang.ClassNotFoundException:no.uib.cipr.matrix.Matrix在 java.net.URLClassLoader.findClass(Unknown Source) 在java.lang.ClassLoader.loadClass(Unknown Source) atsun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) atjava.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
我使用的是 weka 3.8.
有什么想法吗?提前致谢
加载 weka.core 时出现问题.你只需要去weka 存储库 并下载并添加以下 jars:
- mtj.jar
- arpack_combined_all.jar
- core.jar
在此处查看更多详情::>
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
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:
这篇关于Weka 线性回归 ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!