libsvm class not found in weka

帅比萌擦擦* 提交于 2019-12-13 19:42:44

问题


I installed LibSVM in weka from package manager and it is successfully installed. But when I am running the following command-

java -cp ./weka.jar weka.classifiers.meta.FilteredClassifier  -F weka.filters.unsupervised.attribute.RemoveType  -W weka.classifiers.functions.LibSVM  -t training.arff -no-cv -T testing.arff  -v -o 

it Shows that

Can't find class called: weka.classifiers.functions.LibSVM

But other classifiers like Naive Bayes is working. Why it's not finding the class. I am using mac.


回答1:


Weka.jar does not contain LibSVM class. So, to use LibSVM, you have to provide LibSVM.jar in classpath along with weka.jar. You can download LibSVM.jar from

  1. www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+tar.gz (tar.gz)
  2. www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+zip (Zip file)

    You can provide LibSVM.jar in classpath as follows:

java -classpath $pathtoweka.jar/weka.jar:$pathtoLibSVM.jar/libsvm.jar weka.classifiers.meta.FilteredClassifier -t $pathtotrainfile -x 10 -c last -i -d $pathtomodel -F 'weka.filters.unsupervised.attribute.StringToWordVector -R 1 -W 3000 -N 0 -stemmer weka.core.stemmers.NullStemmer -T -I -M 1 -tokenizer weka.core.tokenizers.WordTokenizer -C' -W weka.classifiers.functions.LibSVM -- -B

Hope this helps.



来源:https://stackoverflow.com/questions/36390118/libsvm-class-not-found-in-weka

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