| Bioinformatics Toolbox | ![]() |
Classify data using a support vector machine
Group = svmclassify(SVMStruct, Sample, 'PropertyName', PropertyValue...)
svmclassify(..., 'Showplot', ShowplotValue)
Group = svmclassify(SVMStruct, Sample, 'PropertyName', PropertyValue...) classifies each row of the data in Sample using the information in a support vector machine classifier structure SVMStruct, created using svmtrain. Sample must have the same number of columns as the data used to train the classifier in svmtrain. Group indicates the group to which each row of Sample has been assigned.
svmclassify(..., 'Showplot', ShowplotValue) when Showplot is true, plots thesample data on the figure created using the showplot option in svmtrain.
% 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);
classes = svmclassify(svmStruct,data(test,:),'showplot',true);
% See how well the classifier performed
classperf(cp,classes,test);
cp.CorrectRateThis displays the following plot:

Statistical Toolbox functions classify, knnclassify, quadprog, svmtrain
| sqtlfeatures | svmtrain | ![]() |
© 1994-2005 The MathWorks, Inc.