grid search for multi svm without libsvm

i am using multisvm function downloaded from maths exchange that follows one vs all algorithm. i want to use grid search for optimization of sigma and c of rbf kernel. but i am not clear how can i find that which sigma and c is best for svm rbf kernel after creating a meshgrid. i am trying to consider the best value of c and gamma , first, by training of data with svmtrain . the results of all models are saved in a vector. then i compare the number of supportvectors of the each model and the one with maximum sv is considered as having best c and gamma. is it a true method or i have to do some thing else, if yes then what would be that? secondly, it increases the computation time to almst 6 minutes because i am also unsing multisv for three classes. here is the code for grid searc.
[C,gamma] = meshgrid(0.1:0.1:1, 2:2:20);
%# grid search, and cross-validation cv_acc = zeros(numel(C),1); for i=1:numel(C)
modelss(i) = svmtrain(TrainingSet,G1vAll,'Options', options,'kernel_function','rbf','rbf_sigma',2^gamma(i),'boxconstraint', 2^C(i),'showplot',true) spvec(i)=length(modelss(i).SupportVectors); %% size of all support vectors of all models end [~,idx]=max(spvec);
models(k)=modelss(idx); %% k is number of classes herek=3
kindly help me. i also used libsvm for all this but i could not get how to retrain the data for it. and i want to solve this issue with out using libsvm.
Regards

Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Asked:

on 24 Feb 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!