I'm trying to use SVM-RFE with libsvm library to run on the gene expression dataset. My algorithm is written in Matlab. The particular dataset able to produce 80++% of classification accuracy under the 5-fold CV without applied Feature selection. When I tried to apply svm-rfe on this dataset (same svm parameter setting and use 5-fold CV), the classification result become worse, can only achieve 60++% classification accuracy.
Here is my matlab coding, appreciate if anyone can shed some light on what's wrong with my codes. Thank you in advance.
[label, data] = libsvmread('libsvm_data.scale');
[N D] = size(data);
numfold=5; 
indices = crossvalind ('Kfold',label, numfold);
cp = classperf(label);
for i= 1:numfold
disp(strcat('Fold-',int2str(i)));
testix = (indices == i); trainix = ~testix;
test_data = data(testix,:);  test_label = label(testix);
train_data = data(trainix,:); train_label = label(trainix);
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', kernel, cost, gamma));
    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
    predefined = 100;
   important_feat = r(:,D-predefined+1:end);
    for l=1:length(important_feat)
        testdata(:,l) = test_data (:,important_feat(l));
    end
 [predict_label_itest, accuracy_itest, prob_values] = svmpredict(test_label, testdata, model,'-b 1'); 
acc_itest_fs (:,i) = accuracy_itest(1);
  clear testdata;
end
Mean_itest_fs = mean((acc_itest_fs),2);
Mean_bac_fs = mean (bac_fs,2);  
				
                        
After applying RFE to the traindata, you get a subset of the traindata. So when you use the traindata to train a model, I think you should use the subset of the traindata to train this model.