Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.


Predict out-of-bag response of ensemble


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


Yfit = oobPredict(ens) returns the predicted responses for the out-of-bag data in ens.

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

Argumentos de entrada


A regression bagged ensemble, constructed with fitrensemble.

Argumentos de par nombre-valor

Specify optional comma-separated pairs of Name,Value arguments. Name is 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 Name1,Value1,...,NameN,ValueN.


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

Predeterminado: 1:NumTrained

Output Arguments


A vector of predicted responses for out-of-bag data. Yfit has size(ens.X,1) elements.

You can find the indices of out-of-bag observations for weak learner L with the command



expandir todo

Compute the out-of-bag predictions for the carsmall data set. Display the first three terms of the fit.

Load the carsmall data set and select displacement, horsepower, and vehicle weight as predictors.

load carsmall
X = [Displacement Horsepower Weight];

Train an ensemble of bagged regression trees.

ens = fitrensemble(X,MPG,'Method','Bag');

Find the out-of-bag predictions, and display the first three terms of the fit.

rng(10,'twister') % For reproducibility
Yfit = oobPredict(ens);
Yfit(1:3) % First three terms
ans = 3×1


Más acerca de

expandir todo

Consulte también