Problem with using svmtrain() function

  • Follow


Hello, everyone.
I'm learning using matlab svm toolbox. And now I met a problem.
I know the svm needs a parameter called 'C', neither the linear svm nor unlinear.
But I don't know how to set the parameter to the funciton svmtrain() in matlab toolbox. Can anyone help me and give me some advice?

I tried :
                svmtrain(data,group,'kernel_Function', 'rbf','C', 20);
                svmtrain(data,group,'C', 20);
                svmtrain(data,group, '-C', 20);

They are all wrong....
Thank you in advance.  
0
Reply zhenly 3/20/2010 3:04:03 PM

Hey I am trying to use SVM too and I am stuck, I create a training set and I calculate the descriptors and the keypoints for all the imges, but I do not know how to use the svmtrain to check the accuracy of the matches, can anyone help me??
0
Reply dynamo (2) 7/15/2010 11:02:49 AM


and what does exactly go in the data part in the svmtrain function??
0
Reply dynamo (2) 7/15/2010 11:03:28 AM

dynamo <user@compgroups.net/> wrote in message <z7idnaI4gaVjd6PRnZ2dnUVZ_jednZ2d@giganews.com>...
> and what does exactly go in the data part in the svmtrain function??
> 
I am also new in this. I am using libsvm. the big difference is that in there you need a long string of optional values and their corresponding values. However, as far as I know, in svmtrain the first two inputs are training labels and training datasets. the rest of values are options that you might want to adjust such as kernel type or cost or gamma value and so on. the important thing is if you have 4 classes of a,b,c,d, for 100 samples, your lable vector should be (100*1) and your training dataset should also be (100*n). however, in your training label vector, the values are either a, b, c, or d. the out put of this function (svmtrain) is an struct which would be used when you want to repeat the test with your testing data and evaluate your results. to do so you need following code

% Tr.T:  training labels
% Tr.P:  training datasets
% Ts.T:  testing labels
% Ts.P:  testing datasets

 SVMStruct = svmtrain(Tr.T,Tr.P, options);   % Train dataset using LIBSVM with 
options
          % Test the trained Model on Training Data
          [predictions,accuracy,liklihood] = svmpredict(Ts.T, Ts.P, SVMStruct); 

if you are using svmtrain in bio toolbox, you need something like this

svmStruct = svmtrain(Tr.T,Tr.P);
        classes = svmclassify(svmStruct,Ts.P);

However, I should say I am also new at this and there is a good chance that this does not work

Adham
0
Reply Adham 8/23/2010 6:11:03 AM

5 Replies
782 Views

(page loaded in 0.113 seconds)

Similiar Articles:










7/23/2012 6:09:04 AM


Reply: