L = loss(ens,tbl,ResponseVarName)
L = loss(ens,tbl,Y)
L = loss(ens,X,Y)
L = loss(___,Name,Value)
returns
the mean squared error between the predictions of L
= loss(ens
,tbl
,ResponseVarName
)ens
to
the data in tbl
, compared to the true responses tbl.ResponseVarName
.
returns
the mean squared error between the predictions of L
= loss(ens
,tbl
,Y
)ens
to
the data in tbl
, compared to the true responses Y
.
returns
the mean squared error between the predictions of L
= loss(ens
,X
,Y
)ens
to
the data in X
, compared to the true responses Y
.
computes
the error in prediction with additional options specified by one or
more L
= loss(___,Name,Value
)Name,Value
pair arguments, using any of
the previous syntaxes.

A regression ensemble created with 

Sample data, specified as a table. Each row of If you trained 

Response variable name, specified as the name of a variable
in You must specify 

A matrix of predictor values. Each column of
If you trained 

A numeric column vector with the same number of rows as

Specify optional commaseparated pairs of Name,Value
arguments.
Name
is the argument
name and Value
is the corresponding
value. Name
must appear
inside single quotes (' '
).
You can specify several name and value pair
arguments in any order as Name1,Value1,...,NameN,ValueN
.

Indices of weak learners in the ensemble ranging from Default: 

Function handle for loss function, or the string fun(Y,Yfit,W) where
The returned value Default: 

String representing the meaning of the output
Default: 

A logical matrix of size Default: 

Numeric vector of observation weights with the same number of
elements as Default: 

Weighted mean squared error of predictions. The formula for 
Let n be the number of rows of data, x_{j} be
the jth row of data, y_{j} be
the true response to x_{j},
and let f(x_{j})
be the response prediction of ens
to x_{j}.
Let w be the vector of weights (all one by default).
First the weights are divided by their sum so they add to one: w→w/Σw. The mean squared error L is
$$L={\displaystyle \sum _{j=1}^{n}{w}_{j}{\left(f\left({x}_{j}\right){y}_{j}\right)}^{2}}.$$
Find the loss of an ensemble predictor of the carsmall
data
to find MPG
as a function of engine displacement,
horsepower, and vehicle weight:
load carsmall X = [Displacement Horsepower Weight]; ens = fitensemble(X,MPG,'LSBoost',100,'Tree'); L = loss(ens,X,MPG) L = 4.3904