predict_dt {lazy.tree} | R Documentation |
This function classifies the observations into one of the leaf nodes.
Japanese help file: predict_dt_JPH
predict_dt(X, obj)
X |
The regressor matrix as a data frame |
obj |
The class DecTree object or list of nodes. |
The rules concerning how to classify an observation into Left and Right node
recorded in each obj$node
will be applied for each
observations (rows) in X
.
When X
contains a new set of observations with categorical
regressor variables, those must be converted to factors using the same
levels as the training data.
A list of:
yhat: vector of the predicted values
prob: matrix of the posterior probabilities
Node: vector of the leaf node numbers
Xc=data.frame(square$c1,square$c2)
res1 <- DecTree( square$Class4, Xc, maxdepth=3, print=1 )
pred <- predict_dt( Xc, res1 )
Print(pred$yhat, pred$prob)