CompactTreeBagger.predict - Predict responses using ensemble of bagged decision trees - MATLAB (original) (raw)

Predict responses using ensemble of bagged decision trees

Syntax

Yfit = predict(B,X) Yfit = predict(B,X,Name,Value) [Yfit,stdevs] = predict(___) [Yfit,scores] = predict(___) [Yfit,scores,stdevs] = predict(___)

Description

Yfit = predict(B,X) returns a vector of predicted responses for the predictor data in the table or matrix X, based on the compact ensemble of bagged decision trees B. Yfit is a cell array of character vectors for classification and a numeric array for regression. By default, predict takes a democratic (nonweighted) average vote from all trees in the ensemble.

B is a trained CompactTreeBagger model object, that is, a model returned by compact.

X is a table or matrix of predictor data used to generate responses. Rows represent observations and columns represent variables.

Yfit = predict(B,X,`Name,Value`) specifies additional options using one or more name-value pair arguments:

For regression, [Yfit,stdevs] = predict(___) also returns standard deviations of the computed responses over the ensemble of the grown trees using any of the input argument combinations in previous syntaxes.

For classification, [Yfit,scores] = predict(___) also returns scores for all classes. scores is a matrix with one row per observation and one column per class. For each observation and each class, the score generated by each tree is the probability of the observation originating from the class, computed as the fraction of observations of the class in a tree leaf.predict averages these scores over all trees in the ensemble.

[Yfit,scores,stdevs] = predict(___) also returns standard deviations of the computed scores for classification. stdevs is a matrix with one row per observation and one column per class, with standard deviations taken over the ensemble of the grown trees.

Algorithms