Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem using svmclassify

Subject: problem using svmclassify

From: muzaffar

Date: 13 Oct, 2009 13:51:04

Message: 1 of 1

Dear all group members:

I have some problem while using svmtrain() or svmclassify()

help svmtrain
gives the following example:
when i select and run code the following error/message come up/
.........................................................................
% Load the data and select features for classification
        load fisheriris
        data = [meas(:,1), meas(:,2)];
        % Extract the Setosa class
        groups = ismember(species,'setosa');
        % Randomly select training and test sets
        [train, test] = crossvalind('holdOut',groups);
        cp = classperf(groups);
        % Use a linear support vector machine classifier
        svmStruct = svmtrain(data(train,:),groups(train),'showplot',true);
        % Add a title to the plot
        title(sprintf('Kernel Function: %s',...
              func2str(svmStruct.KernelFunction)),...
              'interpreter','none');
        % Classify the test set using svmclassify
        classes = svmclassify(svmStruct,data(test,:),'showplot',true);
        % See how well the classifier performed
        classperf(cp,classes,test);
        cp.CorrectRate
........................................................................................

Usage: model = svmtrain(training_label_vector, training_instance_matrix, 'libsvm_options');
libsvm_options:
-s svm_type : set type of SVM (default 0)
0 -- C-SVC
1 -- nu-SVC
2 -- one-class SVM
3 -- epsilon-SVR
4 -- nu-SVR
-t kernel_type : set type of kernel function (default 2)
0 -- linear: u'*v
1 -- polynomial: (gamma*u'*v + coef0)^degree
2 -- radial basis function: exp(-gamma*|u-v|^2)
3 -- sigmoid: tanh(gamma*u'*v + coef0)
4 -- precomputed kernel (kernel values in training_instance_matrix)
-d degree : set degree in kernel function (default 3)
-g gamma : set gamma in kernel function (default 1/k)
-r coef0 : set coef0 in kernel function (default 0)
-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)
-n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
-p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
-m cachesize : set cache memory size in MB (default 100)
-e epsilon : set tolerance of termination criterion (default 0.001)
-h shrinking: whether to use the shrinking heuristics, 0 or 1 (default 1)
-b probability_estimates: whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0)
-wi weight: set the parameter C of class i to weight*C, for C-SVC (default 1)
-v n: n-fold cross validation mode
??? Attempt to reference field of non-structure array.

.............
any body can suggest what is wrong?
regards,
from
Bashir

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us