Main Content

Support Vector Machine Classification

Support vector machines for binary or multiclass classification

For greater accuracy and kernel-function choices on low- through medium-dimensional data sets, train a binary SVM model or a multiclass error-correcting output codes (ECOC) model containing SVM binary learners using the Classification Learner app. For greater flexibility, use the command-line interface to train a binary SVM model using fitcsvm or train a multiclass ECOC model composed of binary SVM learners using fitcecoc.

For reduced computation time on high-dimensional data sets, efficiently train a binary, linear classification model, such as a linear SVM model, using fitclinear or train a multiclass ECOC model composed of SVM models using fitcecoc.

For nonlinear classification with big data, train a binary, Gaussian kernel classification model using fitckernel.

Apps

Classification LearnerTrain models to classify data using supervised machine learning

Blocks

ClassificationSVM PredictClassify observations using support vector machine (SVM) classifier for one-class and binary classification (Since R2020b)
ClassificationECOC PredictClassify observations using error-correcting output codes (ECOC) classification model (Since R2023a)
ClassificationLinear PredictClassify observations using linear classification model (Since R2023a)
IncrementalClassificationLinear PredictClassify observations using incremental linear classification model (Since R2023b)
IncrementalClassificationLinear FitFit incremental linear binary classification model (Since R2023b)
Update MetricsUpdate performance metrics in incremental learning model given new data (Since R2023b)

Functions

expand all

Create Model or Template

fitcsvmTrain support vector machine (SVM) classifier for one-class and binary classification
compactReduce size of machine learning model
templateSVMSupport vector machine template

Modify Model

discardSupportVectorsDiscard support vectors for linear support vector machine (SVM) classifier
incrementalLearnerConvert binary classification support vector machine (SVM) model to incremental learner (Since R2020b)
resumeResume training support vector machine (SVM) classifier

Interpret Model

limeLocal interpretable model-agnostic explanations (LIME) (Since R2020b)
partialDependenceCompute partial dependence (Since R2020b)
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
shapleyShapley values (Since R2021a)

Cross-Validate

crossvalCross-validate machine learning model
kfoldEdgeClassification edge for cross-validated classification model
kfoldLossClassification loss for cross-validated classification model
kfoldMarginClassification margins for cross-validated classification model
kfoldPredictClassify observations in cross-validated classification model
kfoldfunCross-validate function for classification

Measure Performance

lossFind classification error for support vector machine (SVM) classifier
resubLossResubstitution classification loss
compareHoldoutCompare accuracies of two classification models using new data
edgeFind classification edge for support vector machine (SVM) classifier
marginFind classification margins for support vector machine (SVM) classifier
resubEdgeResubstitution classification edge
resubMarginResubstitution classification margin
testckfoldCompare accuracies of two classification models by repeated cross-validation
fitSVMPosteriorFit posterior probabilities
fitPosteriorFit posterior probabilities for compact support vector machine (SVM) classifier

Classify Observations

predictClassify observations using support vector machine (SVM) classifier
resubPredictClassify training data using trained classifier

Gather Model Properties

gatherGather properties of Statistics and Machine Learning Toolbox object from GPU (Since R2020b)
fitclinearFit binary linear classifier to high-dimensional data
predictPredict labels for linear classification models
templateLinearLinear learner template
fitckernelFit binary Gaussian kernel classifier using random feature expansion
predictPredict labels for Gaussian kernel classification model
templateKernelKernel learner template
fitcecocFit multiclass models for support vector machines or other classifiers
predictClassify observations using multiclass error-correcting output codes (ECOC) model
templateECOCError-correcting output codes learner template

Classes

expand all

ClassificationSVMSupport vector machine (SVM) for one-class and binary classification
CompactClassificationSVMCompact support vector machine (SVM) for one-class and binary classification
ClassificationPartitionedModelCross-validated classification model
ClassificationLinearLinear model for binary classification of high-dimensional data
ClassificationPartitionedLinearCross-validated linear model for binary classification of high-dimensional data
ClassificationKernelGaussian kernel classification model using random feature expansion
ClassificationPartitionedKernelCross-validated, binary kernel classification model
ClassificationECOCMulticlass model for support vector machines (SVMs) and other classifiers
CompactClassificationECOCCompact multiclass model for support vector machines (SVMs) and other classifiers
ClassificationPartitionedECOCCross-validated multiclass ECOC model for support vector machines (SVMs) and other classifiers
ClassificationPartitionedLinearECOCCross-validated linear error-correcting output codes model for multiclass classification of high-dimensional data
ClassificationPartitionedKernelECOCCross-validated kernel error-correcting output codes (ECOC) model for multiclass classification

Topics