clc
len=length((-):1:2);
for k=1:len
for s=1:len
g_power=k;
c_power=s;
Error(k,s)=fun(g_power,c_power);
end
end
Error
function y=fun(G,C)
file_data = load('y');
Data = file_data.y(1:end-1,:);
Labels = file_data.y(end,:);
cell_data=cell(1,5);
cell_label=cell(1,5);
for i=1:5
cell_data{i}=Data(:,[(10*i-9):10*i (10*i+41):10*i+50]);
cell_label{i}=Labels(:,[(10*i-9):10*i (10*i+41):10*i+50]);
end
g_power=k;
G=2^g_power;
c_power=j;
C=2^c_power;
wrong_numbers=0;
for i=1:5
num=1:5;
test_data=cell_data{i};
test_label=cell_label{i};
num(num==i)=[];
for j=1:4
train_data(:,20*(j-1)+1:20*j)=cell_data{num(j)};
train_label(:,20*(j-1)+1:20*j)=cell_label{num(j)};
end
[Alpha,SV,Bias,Para,nSV,nLabel]=RbfSVC(train_data,
train_label,G,C);
[Test,dec]=SVMClass(test_data,Alpha,SV,Bias,Para,nSV,nLabel);
wrong_numbers=wrong_numbers+sum(test_label ~= Test);
end
Error=wrong_numbers/100