CompactRegressionGP
statistics: CompactRegressionGP
Create a CompactRegressionGP object containing a Gaussian process
regression model without its training data.
CMdl = CompactRegressionGP (Mdl) returns the compact form
of the RegressionGP model Mdl, keeping what is needed to
predict and dropping the rest. It is what compact returns, and it is
not usually constructed directly.
A compact model keeps the active set it predicts from, the prediction weights, the covariance function and its parameters, the explicit basis and its coefficients, the noise standard deviation and the standardizing location and scale. It drops the response, the observation weights, the rows used, the count of observations and the maximized log likelihood, so it can predict but cannot be cross validated, refitted, or asked for its resubstitution loss or its post-fit statistics.
The standard deviation and the prediction intervals remain available, because the active set of an exactly fitted model is the whole of the training predictors and the factorization can be rebuilt from it.
See also: RegressionGP, fitrgp
Source Code: CompactRegressionGP
The CompactRegressionGP class contains the following properties:
A cell array of character vectors. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A cell array of character vectors. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A character vector. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A vector of positive integers, or empty. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
'Exact' or 'None'. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A character vector or a function handle. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A numeric vector, empty when the basis is 'None'. This property
is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A positive scalar. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A character vector or a function handle. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A structure with fields Name, KernelParameters and
KernelParameterNames. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
'Exact'. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A numeric vector with one weight per active set vector. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
An numeric matrix, standardized where the model standardized its predictors. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
'Random'. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A positive integer scalar. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A numeric vector, or empty. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A numeric vector, or empty. This property is read-only.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
A character vector, or the text of the function handle that was supplied. Assigning to it accepts either.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
The CompactRegressionGP class offers the following public methods:
CompactRegressionGP: yFit = predict (obj, XC)
CompactRegressionGP: [yFit, ySD, yInt] = predict (obj, XC)
CompactRegressionGP: […] = predict (…, 'Alpha', alpha)
yFit = predict (obj, XC) returns the predicted
response of the CompactRegressionGP model obj at the
points in XC, and the further outputs are the standard deviation
of each predicted response and the prediction intervals, exactly as the
full model returns them.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
CompactRegressionGP: L = loss (obj, X, Y)
CompactRegressionGP: L = loss (…, name, value)
L = loss (obj, X, Y) returns the mean
squared error of the model obj on the data X and Y,
and accepts the same 'LossFun' and 'Weights' pairs the
full model accepts.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
CompactRegressionGP: savemodel (obj, filename)
savemodel (obj, filename) saves the model obj
into filename in a form loadmodel can read back.
A compact model predicts what the full model predicts, and carries none of the training data.
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03
x = linspace (0, 1, 20)'; y = sin (2*pi*x) + 0.05 * cos (9*x); Mdl = fitrgp (x, y); CMdl = compact (Mdl)
CMdl =
CompactRegressionGP
ResponseName: 'Y'
NumPredictors: 1
KernelFunction: 'SquaredExponential'
PredictMethod: 'Exact'
Sigma: 0.00687107
xq = [0.15; 0.55; 0.85]; [yq, ysd] = predict (CMdl, xq)
yq = 0.8193 -0.2981 -0.7981 ysd = 7.8751e-03 7.6921e-03 7.8751e-03