Hi, when I try to run my libsvm the command window display an error wrong input format at line 1
3 views (last 30 days)
Show older comments
function train
clear all; clc; % cross validation [label_vector,instance_matrix]=libsvmread('train_dw vs control.txt');
bestcv = 0; for log2c = -30:30, for log2g = -40:40, cmd = ['-v 5 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g)]; cv = svmtrain(label_vector, instance_matrix, cmd); if (cv >= bestcv), bestcv = cv; bestc = 2^log2c; bestg = 2^log2g; end fprintf('%g %g %g (best c=%g, g=%g, rate=%g)\n', log2c, log2g, cv, bestc, bestg, bestcv); end end
% % % build model model=svmtrain(label_vector,instance_matrix,'-s 0 -t 2 -c 4 -d 3 -g 0.125 -e 0.0001');
% test_data [testlabel_vector,testinstance_matrix]=libsvmread('test_dw vs control.txt');
[predict_label,accuracy,dec_values]=svmpredict(testlabel_vector,testinstance_matrix,model);
fprintf('predict_label=%g, accuracy=%g,dec_values=%g)\n', predict_label,accuracy,dec_values);
0 Comments
Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!