Documentation

oobPredict

Class:RegressionBaggedEnsemble

Predict out-of-bag response of ensemble

Syntax

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

Description

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

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

Input Arguments

ens

A regression bagged ensemble, constructed withfitensemble.

Name-Value Pair Arguments

Specify optional comma-separated pairs ofName,Valuearguments.Nameis the argument name andValueis the corresponding value.Namemust appear inside single quotes (' '). You can specify several name and value pair arguments in any order asName1,Value1,...,NameN,ValueN.

'learners'

Indices of weak learners in the ensemble ranging from1toNumTrained.oobLossuses only these learners for calculating loss.

Default:1:NumTrained

Output Arguments

Yfit

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

You can find the indices of out-of-bag observations for weak learnerLwith the command

~ens.UseObsForLearner(:,L)

Examples

Compute out-of-bag predictions for thecarsmalldata. Look at the first three terms of the fit:

load carsmall X = [Displacement Horsepower Weight]; ens = fitensemble(X,MPG,'bag',100,'Tree',... 'type','regression'); Yfit = oobPredict(ens); Yfit(1:3) % first three terms ans = 15.7964 14.7162 14.8062

Definitions

expand all

See Also

|

Was this topic helpful?