## Documentation Center |

`Y = predict(B,X)[Y,stdevs] = predict(B,X)[Y,scores] = predict(B,X)[Y,scores,stdevs] = predict(B,X)Y = predict(B,X,'param1',val1,'param2',val2,...)`

`Y = predict(B,X)` computes predicted response
of the trained ensemble `B` for data `X`.
The output has one prediction for each row of `X`.
The returned `Y` is a cell array of strings for classification
and a numeric array for regression.

For regression, `[Y,stdevs] = predict(B,X)` also
returns standard deviations of the computed responses over the ensemble
of the grown trees.

For classification, `[Y,scores] = predict(B,X)` 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 this observation originating from this class computed as the fraction
of observations of this class in a tree leaf. `predict` averages
these scores over all trees in the ensemble.

`[Y,scores,stdevs] = predict(B,X)` 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.

`Y = predict(B,X,'param1',val1,'param2',val2,...)` specifies
optional parameter name/value pairs:

'trees' | Array of tree indices to use for computation of responses.
Default is 'all'. |

'treeweights' | Array of NTrees weights for weighting votes
from the specified trees. |

'useifort' | Logical matrix of size Nobs-by-NTrees indicating
which trees to use to make predictions for each observation. By default
all trees are used for all observations. |

Was this topic helpful?