Documentation |
Yfit = predict(tree,Xdata)
[Yfit,node]
= predict(tree,Xdata)
[Yfit,node]
= predict(tree,Xdata,Name,Value)
Yfit = predict(tree,Xdata) returns predicted responses to the data in Xdata, based on the tree regression tree.
[Yfit,node] = predict(tree,Xdata) returns the predicted node numbers of tree in response to Xdata.
[Yfit,node] = predict(tree,Xdata,Name,Value) predicts response with additional options specified by one or more Name,Value pair arguments.
tree |
Regression tree created by fitrtree, or by the compact method. |
Xdata |
Numeric array with the same number of columns as the array used for creating tree. Each row of Xdata corresponds to one data point, and each column corresponds to one predictor. |
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.
'Subtrees' |
Numeric vector of pruning levels, with 0 representing the full, unpruned tree. To use the Subtrees name-value pair, tree must include a pruning sequence as created by the fitrtree or prune methods. If Subtrees has T elements, and X has N rows, then Yfit is an N-by-T matrix. The ith column of Yfit contains the fitted values produced by the Subtrees(I) subtree. Similarly, node is an N-by-T matrix. Subtrees must be sorted in ascending order. (To compute fitted values for a tree that is not part of the optimal pruning sequence, first use prune to prune the tree.) Default: 0 |
Yfit |
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 tree regression model. |
node |
Numeric vector of node numbers for the predictions. Each entry corresponds to the predicted leaf node in tree for the corresponding row of Xdata. |