mdl = fitcsvm(X, Y)
mdl = fitcsvm(X, Y, Name, Value)
label = predict(mdl, Xnew)
[label, score] = predict(mdl, Xnew)
fitcsvm creates a ClassificationSVM object from numeric predictors X and two-class labels Y.
Name-value arguments include ClassNames, KernelFunction, KernelScale, PolynomialOrder, BoxConstraint, Cost, Standardize, IterationLimit, Tolerance, and PredictorNames. Supported kernels are linear, gaussian, rbf, and polynomial.
X = [0 0; 0 1; 1 0; 1 1; 5 5; 5 6; 6 5; 6 6];
Y = [1; 1; 1; 1; 2; 2; 2; 2];
mdl = fitcsvm(X, Y, 'KernelFunction', 'linear');
[label, score] = predict(mdl, [0.2 0.2; 5.2 5.2])
| Version | Description |
|---|---|
| 2.0.0 | initial version |