RegressionLinear
statistics: RegressionLinear
Linear regression model for high dimensional data.
A RegressionLinear object fits a linear model,
X * Beta + Bias, to a continuous response by minimizing a
regularized average loss. The loss is the epsilon-insensitive loss for a
support vector machine and the squared error for a least squares fit, and
the penalty is either a ridge or a lasso one.
Unlike the other regression models of this package the object holds no
copy of the training data: the coefficients, the intercept and the fitting
options are the whole model. That is what makes it suited to data with
more predictors than a kernel matrix could carry, and it is why the class
has no compact method and no resubstitution methods.
A vector of regularization strengths fits one model per value in a single
object. Beta is then a matrix and Bias a
row, every method returns one column per strength, and
selectModels narrows the object down to the strengths worth
keeping.
Create a RegressionLinear object with fitrlinear.
See also: fitrlinear, RegressionKernel, RegressionSVM
Source Code: RegressionLinear
The RegressionLinear class contains the following properties:
A nonnegative scalar for a support vector machine, and empty for a
least squares fit, which has no such band. It defaults to the
interquartile range of the response over 13.49, an estimate of its
standard deviation, or to 0.1 when that range is zero. This
property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A character vector, or the text of the function handle that was supplied. Assigning to it accepts either.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A cell array of character vectors with one name per column of the
training data, defaulting to 'x1', 'x2' and so on.
This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A row vector of column indices, empty when every predictor is numeric. This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A character vector, defaulting to 'Y'. This property is
read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A cell array of character vectors. It equals PredictorNames
unless categorical predictors were expanded into indicator variables.
This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
Either 'svm' or 'leastsquares'. This property is
read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A column, or a matrix with one column per
regularization strength when Lambda holds more than one. This
property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A scalar, or a row with one element per regularization
strength. It is zero throughout when the model was fitted with
'FitBias' set to false. This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
'epsiloninsensitive' for a support vector machine and
'mse' for a least squares fit. This is the loss of the
objective, which is not the loss loss reports unless it is
asked for. This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A nonnegative scalar, or a row of them in ascending order. It defaults to the reciprocal of the number of observations used to train the model. This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
A structure holding every parameter of the fit, including the ones
that a different solver would have used and the 'auto' values
before they were resolved. This property is read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
'ridge (L2)' or 'lasso (L1)'. This property is
read-only.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
The RegressionLinear class offers the following public methods:
RegressionLinear: obj = RegressionLinear (X, Y)
RegressionLinear: obj = RegressionLinear (…, name, value)
obj = RegressionLinear (X, Y) fits a linear
support vector machine to the predictor matrix X and
the continuous response Y.
obj = RegressionLinear (…, name,
value) takes the following Name-Value pairs.
| Name | Value |
|---|---|
'Learner' | 'svm', the default, or
'leastsquares'. The first minimizes the epsilon-insensitive
loss and the second the squared error. |
'Epsilon' | Half the width of the insensitive band,
a nonnegative scalar or 'auto', which is the interquartile
range of Y over 13.49. It applies to a support vector machine
alone. |
'Regularization' | 'ridge' or
'lasso'. It defaults to 'lasso' when the solver is
'sparsa' and to 'ridge' otherwise. |
'Lambda' | 'auto', the default, which is the
reciprocal of the number of observations, or a nonnegative scalar, or
a vector of them. A vector fits one model per value. |
'Solver' | One of 'sgd', 'asgd',
'dual', 'bfgs', 'lbfgs' and 'sparsa',
or a cell array of them applied in turn, each warm starting the next. |
'Beta' | Initial coefficients, a column or a matrix. It defaults to zeros. |
'Bias' | Initial intercept, a scalar or a row. It defaults to the weighted mean of Y for a least squares fit and to its weighted median for a support vector machine. |
'FitBias' | Whether to fit an intercept at all, true by default. |
'PostFitBias' | Whether to refit the intercept once the coefficients are settled, false by default. |
'ObservationsIn' | 'rows', the default, or
'columns', which transposes X before fitting. |
'BetaTolerance' | Relative tolerance on the
coefficients, 1e-4 by default. |
'GradientTolerance' | Absolute tolerance on the
gradient’s infinity norm, 1e-6 by default. |
'DeltaGradientTolerance' | Tolerance on the
complementarity gap of the 'dual' solver, 0.1 by
default. |
'IterationLimit' | Largest number of iterations,
1000 by default. |
'PassLimit' | Largest number of passes over the data
for the stochastic solvers, 1 by default, and 10 for
'dual'. |
'BatchSize' | Mini-batch size of the stochastic
solvers, 10 by default. |
'BatchLimit' | Largest number of mini-batches. |
'LearnRate' | Step size of the stochastic solvers. |
'OptimizeLearnRate' | Whether to halve the step size when the objective rises, true by default. |
'TruncationPeriod' | Number of mini-batches between
soft thresholdings under a lasso penalty, 10 by default. |
'NumCheckConvergence' | Number of passes between
convergence checks of the 'dual' solver, 2 by
default. MathWorks documents 5; R2024a and R2026a both
report 2. |
'HessianHistorySize' | Number of curvature pairs the
quasi-Newton solvers keep, 15 by default. |
'ResponseTransform' | A transformation applied to the predicted response, named or given as a function handle. |
'Weights' | One nonnegative weight per observation. |
'PredictorNames' | One name per predictor. |
'ResponseName' | A name for the response. |
'CategoricalPredictors' | Indices of the categorical predictors. |
The default solver is 'sparsa' under a lasso penalty. Under a
ridge penalty it is 'bfgs' when there are no more than 100
predictors, and beyond that 'dual' for a support vector
machine and 'sgd' for a least squares fit.
See also: fitrlinear, RegressionKernel
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
RegressionLinear: yFit = predict (obj, XC)
yFit = predict (obj, XC) returns one
predicted value per row of XC, and one column per regularization
strength. ResponseTransform is applied to the result.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
RegressionLinear: l = loss (obj, X, Y)
RegressionLinear: l = loss (…, name, value)
l = loss (obj, X, Y) returns the mean
squared error, one value per regularization strength.
l = loss (…, name, value) takes
'LossFun', either 'mse' or
'epsiloninsensitive', and 'Weights'. The
epsilon-insensitive loss needs a band to be insensitive within, so it
is offered by a support vector machine alone.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
RegressionLinear: sub = selectModels (obj, idx)
sub = selectModels (obj, idx) returns a model
holding only the strengths idx names, which may be indices into
Lambda or a logical vector over it.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
RegressionLinear: savemodel (obj, filename)
savemodel (obj, filename) saves the model
obj into filename in a form loadmodel can read
back.
Fit fuel consumption on four engine measurements and read the coefficients and the insensitive band the fit chose for itself.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
Least squares has no insensitive band, so Epsilon is empty, and its loss is the mean squared error the fit minimizes.
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok))
Mdl =
RegressionLinear
ResponseName: 'Y'
ResponseTransform: 'none'
Beta: [4x1 double]
Bias: 24
Lambda: 0.0107527
Learner: 'svm'
yFit = predict (Mdl, X(find (ok, 3),:))
yFit = 20.952 20.783 21.008
load carsmall X = [Acceleration, Displacement, Horsepower, Weight]; ok = ! any (isnan ([X, MPG]), 2); Mdl = RegressionLinear (X(ok,:), MPG(ok), 'Learner', 'leastsquares'); band = Mdl.Epsilon
band = [](0x0)
mse = loss (Mdl, X(ok,:), MPG(ok))
mse = 61.264