resubPredict

Class: RegressionEnsemble

Predict response of ensemble by resubstitution

Syntax

Yfit = resubPredict(ens)
Yfit = resubPredict(ens,Name,Value)

Description

Yfit = resubPredict(ens) returns the response ens predicts for the data ens.X. Yfit is the predictions of ens on the data that fitensemble used to create ens.

Yfit = resubPredict(ens,Name,Value) predicts responses with additional options specified by one or more Name,Value pair arguments.

Input Arguments

ens

A regression ensemble created with fitensemble.

Name-Value Pair Arguments

Specify optional comma-separated 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.

'learners'

Indices of weak learners in the ensemble ranging from 1 to NumTrained. oobLoss uses only these learners for calculating loss.

Default: 1:NumTrained

Output Arguments

Yfit

A vector of predicted responses to the training data, with ens.X elements.

Examples

Find the resubstitution predictions of mileage from the carsmall data based on horsepower and weight, and look at their mean square difference from the training data.

load carsmall
X = [Horsepower Weight];
ens = fitensemble(X,MPG,'LSBoost',100,'Tree');
Yfit = resubPredict(ens);
MSE = mean((Yfit - ens.Y).^2)

MSE =
    6.4336

This is the same as the result of resubLoss:

resubLoss(ens)

ans =
    6.4336
Was this topic helpful?