treepredict
statistics: V = treepredict (X, Children, CutPredictorIndex, CutPoint, Value)
statistics: V = treepredict (…, CutCategories)
statistics: [V, node] = treepredict (…)
Evaluate a binary decision tree on new data.
V = treepredict (X, Children,
CutPredictorIndex, CutPoint, Value) sends each row of the
NxP matrix X down the tree and returns the value of the node it
comes to rest at. It is the prediction engine shared by
ClassificationTree and RegressionTree, and is not meant to be
called directly.
Children, CutPredictorIndex and CutPoint are the node table
returned by treetrain, a zero in Children marking a leaf.
Value carries one row per node: the class probabilities of a
classifier, in which case V is NxK, or the mean of a
regression, in which case it is Nx1.
[V, node] = treepredict (…) also returns the index
of the node each row came to rest at.
A row is stopped by the first node whose split predictor it is missing, and takes that node’s value, which is how such a row was held back rather than sent to a child while the tree was grown.
CutCategories, the Mx2 cell array treetrain returns,
gives the levels a categorical cut sends left and right. A row goes the way
its level is listed, and a row whose level is in neither list, one the node
never saw, is stopped there like a missing value.
See also: treetrain
Source Code: treepredict