Categories &

Functions List

Function Reference: fitckernel

statistics: Mdl = fitckernel (X, Y)
statistics: Mdl = fitckernel (…, name, value)
statistics: [Mdl, FitInfo] = fitckernel (…)

Fit a Gaussian kernel binary classifier.

Mdl = fitckernel (X, Y) returns a ClassificationKernel object fitted to the predictor data X and the two class response Y, where X is an NxP numeric matrix and Y has as many rows as X.

Mdl = fitckernel (…, name, value) passes the given Name-Value pairs to the model. They are documented under ClassificationKernel, and the ones most often wanted are 'Learner', 'NumExpansionDimensions', 'KernelScale', 'Lambda', 'BoxConstraint' and 'Standardize'.

[Mdl, FitInfo] = fitckernel (…) also returns a structure describing the optimization: the objective it reached, the gradient it left, and the tolerances it was given.

Mdl = fitckernel (…, cvopt, value) returns a ClassificationPartitionedKernel instead when one of 'CrossVal', 'KFold', 'Holdout', 'Leaveout' and 'CVPartition' is given. A cross-validated model describes no single fit, so FitInfo is not available beside it.

See also: ClassificationKernel, ClassificationLinear, fitclinear

Source Code: fitckernel

Fit a Gaussian kernel classifier to the two overlapping iris species and read what the optimization did.

 load fisheriris
 X = meas(51:end,:);
 Y = species(51:end);
 [Mdl, FitInfo] = fitckernel (X, Y)
Mdl =

  ClassificationKernel

              ResponseName: 'Y'
                ClassNames: {'versicolor'  'virginica'}
                   Learner: 'svm'
    NumExpansionDimensions: 128
               KernelScale: 1
                    Lambda: 0.01
             BoxConstraint: 1

FitInfo =

  scalar structure containing the fields:

    Solver = LBFGS-fast
    LossFunction = hinge
    Lambda = 0.010000
    BetaTolerance = 1.0000e-04
    GradientTolerance = 1.0000e-06
    ObjectiveValue = 0.1840
    GradientMagnitude = 1.0000e-02
    RelativeChangeInBeta = 1.4402e-05
    FitTime = 0
    History = [](0x0)