Categories &

Functions List

Function Reference: fitrkernel

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

Fit a Gaussian kernel regression model.

Mdl = fitrkernel (X, Y) returns a RegressionKernel object fitted to the predictor data X and the continuous response Y, where X is an NxP numeric matrix and Y an Nx1 numeric vector with as many rows as X.

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

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

Mdl = fitrkernel (…, cvopt, value) returns a RegressionPartitionedKernel 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: RegressionKernel, RegressionLinear, fitrlinear

Source Code: fitrkernel

Fit a Gaussian kernel regression to fuel consumption and read what the optimization did.

 load carsmall
 X = [Acceleration, Displacement, Horsepower, Weight];
 ok = ! any (isnan ([X, MPG]), 2);
 [Mdl, FitInfo] = fitrkernel (X(ok,:), MPG(ok))
Mdl =

  RegressionKernel

              ResponseName: 'Y'
                   Learner: 'svm'
    NumExpansionDimensions: 128
               KernelScale: 1
                    Lambda: 0.0107527
             BoxConstraint: 1
                   Epsilon: 0.926612

FitInfo =

  scalar structure containing the fields:

    Solver = LBFGS-fast
    LossFunction = epsiloninsensitive
    Lambda = 0.010753
    BetaTolerance = 1.0000e-04
    GradientTolerance = 1.0000e-06
    ObjectiveValue = 5.4800
    GradientMagnitude = 3.3361e-03
    RelativeChangeInBeta = 5.1147e-05
    FitTime = 0
    History = [](0x0)