我正在尝试使用 weka+Matlab 对一些分类器进行分类,但是,一些分类器不接受我使用 setOptions 发送的参数。
看这段测试代码,不知道为什么,Logistic分类器构建正确,但是Ibk却出现错误:
%Load the csv File returning an object with the features.
wekaObj= loadCSV('C:\experimento\selecionados para o experimento\Experimento Final\dados\todos.csv');
%Create an instance of the Logistic classifier - OK
classifier1=javaObject(['weka.classifiers.','functions.Logistic']);
classifier1.setOptions('-R 1.8E-8 -M -1');
classifier1.buildClassifier(wekaObj);
%Create an instance of the K-nearest Neighbour classifier - Error
classifier2=javaObject(['weka.classifiers.','lazy.IBk']);
classifier2.setOptions('-K 10 -W 0 -A "weka.core.neighboursearch.LinearNNSearch -A \"weka.core.EuclideanDistance -R first-last\""');
classifier2.buildClassifier(wekaObj);
%Create an instance of the random forest classifier - Error
classifier3=javaObject(['weka.classifiers.','trees.RandomForest']);
classifier3.setOptions('-I 1200 -K 0 -S 1 -num-slots 1');
classifier3.buildClassifier(wekaObj);
%Create an instance of the MultiLayer Perceptron classifier - Error
classifier4=javaObject(['weka.classifiers.','functions.MultilayerPerceptron']);
classifier4.setOptions('-L 0.1 -M 0.1 -N 500 -V 0 -S 0 -E 20 -H a');
classifier4.buildClassifier(wekaObj);
错误是一个:
Error using weka.classifiers.lazy.IBk/setOptions
Java exception occurred:
java.lang.Exception: Illegal options: -K 10 -W 0 -A
"weka.core.neighboursearch.LinearNNSearch -A "weka.core.EuclideanDistance -R
first-last""
at weka.core.Utils.checkForRemainingOptions(Utils.java:534)
at weka.classifiers.lazy.IBk.setOptions(IBk.java:715)
这里有人遇到同样的问题吗?
obs:对不起,可能的错别字,英语是我的第二语言。