I'm trying to use SVM-RFE with libsvm library. My algorithm is written in Matlab.
Here is my matlab coding,Is wrong my codes or correct?? Thank you in advance..
clear all;
clc;
xData=load ('ozone.data');
data=xData(:,2:74);
[N D] = size(data);
D=D-1;
train_label=data(1:15,73);
train_data=data(1:15,1:72);
model = svmtrain(train_label, train_data, sprintf('-s 0 -t 0'));
s = 1:D;
r = [];
iter = 1;
while ~isempty(s)
X = train_data(:,s);
fs_model = svmtrain(train_label, X, sprintf('-s 0 -t %f -c %f -g %f -b 1',0, 10, (1/72)));
w = fs_model.SVs' * fs_model.sv_coef; %'
c = w.^2;
[c_minvalue, f] = min(c);
r = [s(f),r];
ind = [1:f-1, f+1:length(s)];
s = s(ind);
iter = iter + 1;
end