2

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 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

5 Comments

I can understand the last part. I have training and testing set as a vector in arff file. Can not i use those? What is model here($parhtomodel)?
Do i need to change the aarf file into libsvm supported file?
As far as I Know libSvm don't require any special arff structure, So you may not need to change arff structure. However, I don't know wheather it accepts float(if vectors are float) values as features. $pathtomodel refers to model generated after training.
Thank you for your helpful answer, the objects in the links are nor found.
@F505 They might be removed from the location.....Just search LibSVM jar download on google and you will get the jars

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.