Predict response of ensemble by resubstitution
Yfit = resubPredict(ens)
Yfit = resubPredict(ens,Name,Value)
A regression ensemble created with
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Indices of weak learners in the ensemble ranging from
A vector of predicted responses to the training data, with
Find the resubstitution predictions of mileage from the
carsmall data, and look at their mean-squared difference from the training data.
carsmall data set and select horsepower and vehicle weight as predictors.
load carsmall X = [Horsepower Weight];
Train an ensemble of regression trees.
ens = fitrensemble(X,MPG,'Method','LSBoost','Learners','Tree');
Find the resubstitution predictions of
Yfit = resubPredict(ens);
Calculate the mean-squared difference of the resubstitution predictions from the training data.
MSE = mean((Yfit - ens.Y).^2)
MSE = 0.5836
Confirm that the result is the same as the result of
ans = 0.5836