I am currently trying to run LibSVM
located here: https://www.csie.ntu.edu.tw/~cjlin/libsvm
I only have access to MATLAB 2011b. When I try to run the example data file (heartscale) included with the LibSVM
package with different C
and gamma
values I get the same accuracy results.
This happens for other data sets as well.
I build a for
loop and loop through the different C
and gamma
values and the accuracy %'s do not change.
I am doing this to find the best C
and gamma
to use for the data set (cross-validation) as recommended in the documentation "A Practical Guide to Support Vector Classification" located on the above website.
When I look at the accuracy_mat
that I build below, the values are all the same. Even the outputs from svmpredict
are the same.
I have read through the documentation multiple times and looked at the FAQ on the website and would appreciate inputs on this from SVM-practitioners.
[heart_scale_label, heart_scale_inst] = libsvmread( 'heartscale' );
C = { '2^-5','2^-3','2^-1'};
g = {'2^-15','2^-3','2^-1'};
accuracy_mat = zeros( length( g ), length( c ) );
data_num = length( heart_scale_inst(:,1) );
t = zeros( data_num, 1 );
for i = 1:length( g )
for j = 1:length( C )
c_train_inputs = ['-c ', C{j}];
g_train_inputs = ['-g ', g{i}];
c_and_g_inputs = [c_train_inputs, g_train_inputs];
model = svmtrain( heart_scale_label, ...
heart_scale_inst, ...
[c_and_g_inputs, '-b 1'] ...
);
[predict_label, ...
accuracy, ...
prob_estimates] = svmpredict( heart_scale_label, ...
heart_scale_inst, ...
model, ...
'-b 1' ...
);
accuracy_mat(i,j) = max( accuracy );
end
end