在libsvm-3.23/matlab下运行这个程序:
data = [180 76;184 77;160 52;165 55];
label = [1; 1; -1; -1];
model = libsvmtrain(label,data,'-s 0 -t 2 -c 1 -g 0.1');
testdata = [189 82;163 49];
testdatalabel = [1;1];
[predictlabel,accuracy] = libsvmpredict(testdatalabel, testdata, model);
出来的结果是
*.*
optimization finished, #iter = 5
nu = 0.902449
obj = -1.805008, rho = 0.067372
nSV = 4, nBSV = 0
Total nSV = 4
Usage: [predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options')
[predicted_label] = svmpredict(testing_label_vector, testing_instance_matrix, model, 'libsvm_options')
Parameters:
model: SVM model structure from svmtrain.
libsvm_options:
-b probability_estimates: whether to predict probability estimates, 0 or 1 (default 0); one-class SVM not supported yet
-q : quiet mode (no outputs)
Returns:
predicted_label: SVM prediction output vector.
accuracy: a vector with accuracy, mean squared error, squared correlation coefficient.
prob_estimates: If selected, probability estimate vector.
为什么没有显示predictlabel = [1;-1]?