Class: CompactRegressionEnsemble

Predict response of ensemble


Yfit = predict(ens,Xdata)
Yfit = predict(ens,Xdata,Name,Value)


Yfit = predict(ens,Xdata) returns predicted responses to the data in Xdata, based on the ens regression ensemble model.

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

Input Arguments


Regression ensemble created by fitensemble, or by the compact method.


Numeric array with the same number of columns as the array used for creating ens. Each row of Xdata corresponds to one data point, and each column corresponds to one predictor.

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.


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

Default: 1:NumTrained


A logical matrix of size N-by-NumTrained, where N is the number of observations in ens.X, and NumTrained is the number of weak learners. When UseObsForLearner(I,J) is true, predict uses learner J in predicting observation I.

Default: true(N,NumTrained)

Output Arguments


A numeric column vector with the same number of rows as Xdata. Each row of Yfit gives the predicted response to the corresponding row of Xdata, based on the ens regression model.


Find the predicted mileage for a four-cylinder car, with 200 cubic inch engine displacement, 150 horsepower, weighing 3000 lbs, based on the carsmall data:

load carsmall
X = [Cylinders Displacement Horsepower Weight];
rens = fitensemble(X,MPG,'LSBoost',100,'Tree');
Mileage = predict(rens,[4 200 150 3000])

Mileage =

See Also


Was this topic helpful?