I have trained LIBSVM model in WEKA (3.7.3) and now want to use it in my java code. However, I'm getting an exception.
Exception:Attempt to invoke interface method 'double weka.classifiers.Classifier.classifyInstance(weka.core.Instance)' on a null object reference
All other models work fine in this java code. Moreover, the version of WEKA jar is exactly the same as I'm using for training models. I don't have any LIBSVM jar in my app because I'm using the trained model. Do I need to place LIBSVM jar in my app ?
What am I missing here ?
inputStream = getApplicationContext().getAssets().open("svm.model");
classifier = (Classifier) weka.core.SerializationHelper.read(inputStream);
This is the content of the model:
=== Model information ===
Filename: svm.model
Scheme: weka.classifiers.functions.LibSVM -S 0 -K 2 -D 3 -G 0.0 -R 0.0 -N 0.5 -M 40.0 -C 1.0 -E 0.001 -P 0.1 -model "D:\\Program Files (x86)\\Weka-3-7" -seed 1
Relation: Sho_gsw30SVRNULL-weka.filters.unsupervised.attribute.Remove-R5-13,18-26,31-39,44-130
Attributes: 17
F1
F2
F3
F4
F14
F15
F16
F17
F27
F28
F29
F30
F40
F41
F42
F43
class
=== Classifier model ===
LibSVM wrapper, original code by Yasser EL-Manzalawy (= WLSVM)
Update: I tried WEKA SMO (support vector machine classifier) and it works fine in my code, but not the LIBSVM one.
Update: I tried WEKA SMO (support vector machine classifier) and it works fine in my code, but not the LIBSVM one.