0
怎麼辦秧雞分類的分割比例在MATLAB 喜有下面的代碼,但我不能得到分流百分比則顯示錯誤如何分割秧雞分類器的比例在MATLAB
javaaddpath('weka.jar');
import weka.core.Instances.*
import weka.classifiers.functions.supportVector.*
%import weka.core.converters.ConverterUtils$DataSource.*
filename = 'c.arff';
filename1 = 'ctest.arff';
cross='10';
reader = javaObject('java.io.FileReader', filename);
data = javaObject('weka.core.Instances', reader);
if (data.classIndex() == -1) % -1 means that it is undefined
data.setClassIndex(data.numAttributes() - 1);
end
c = weka.classifiers.functions.SMO();
c.setC(100);
k = weka.classifiers.functions.supportVector.Puk();
k.setOmega(1.0);
k.setSigma(1.0);
c.setKernel(k);
c.buildClassifier(data); %% "data" here is the training data
% evaluate model (simple evaluation over training set)
ev = weka.classifiers.Evaluation(data); % "data" here is the test data
v(1) = java.lang.String('-t');
v(2) = java.lang.String(filename);
v(3) = java.lang.String('-T');
v(4) = java.lang.String(filename1);
v(5) = java.lang.String('-split-percentage');
v(6) = java.lang.String('80');
v(7) = java.lang.String('-i');
params = cat(1,v(1:end));
ev.evaluateModel(c, params)