Categories &

Functions List

Function Reference: fitrgp

statistics: Mdl = fitrgp (X, Y)
statistics: Mdl = fitrgp (…, name, value)

Fit a Gaussian process regression model.

Mdl = fitrgp (X, Y) returns a RegressionGP 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 = fitrgp (…, name, value) passes the given Name-Value pairs to the model. They are documented under RegressionGP, and the ones most often wanted are 'KernelFunction', 'BasisFunction', 'Standardize', 'Sigma' and 'FitMethod'.

When any of 'CrossVal', 'KFold', 'Holdout', 'Leaveout' or 'CVPartition' is given, a cross validated model is returned instead, as a RegressionPartitionedModel. Only one of them may be given at a time.

See also: RegressionGP, CompactRegressionGP, RegressionPartitionedModel

Source Code: fitrgp

Fit a Gaussian process to a noisy sine and predict on a fine grid.

 x = linspace (0, 2*pi, 30)';
 y = sin (x) + 0.1 * cos (7*x);
 Mdl = fitrgp (x, y)
Mdl =

  RegressionGP

             ResponseName: 'Y'
          NumObservations: 30
            NumPredictors: 1
           KernelFunction: 'SquaredExponential'
            BasisFunction: 'Constant'
                FitMethod: 'Exact'
            PredictMethod: 'Exact'
                    Sigma: 0.0785048
            LogLikelihood: 17.7617
 xq = linspace (0, 2*pi, 5)';
 [yq, ysd] = predict (Mdl, xq)
yq =

   5.8489e-02
   9.9188e-01
   2.6736e-03
  -1.0015e+00
   2.3645e-02

ysd =

   0.098184
   0.084407
   0.084101
   0.084407
   0.098184