Description Usage Arguments Details Value Author(s) References See Also Examples
Returns predictions from a fitted oblique.tree
object.
1 2 3 4 5 6 7 8 |
object |
Fitted model object of class |
newdata |
Data frame containing the values at which predictions are required. The predictors referred to in the right side of |
type |
Character string denoting how predictions are to be returned, i.e. class probabilities (default), a tree object, class predictions or predictions to leaf nodes. |
eps |
A lower bound for the probabilities, used if events of predicted probability zero occur in |
update.tree.predictions |
Logical vector denoting whether tree predictions ( |
... |
Further arguments passed to or from other methods. |
This function is a method for the generic function predict()
for objects of class c("oblique.tree","tree")
. It can be invoked by calling predict(x)
for an object x
of the appropriate class or directly by calling predict.oblique.tree(x)
regardless of the class of the object.
If type = "vector"
:
a matrix of predicted class probabilities is returned. This object is obtained by dropping observations down object
.
If type = "tree"
:
an object of class c("oblique.tree","tree")
is returned with new values for frame$n
and frame$dev
.
If type = "class"
:
a factor of the predicted classes (that with highest posterior probability, with ties split randomly).
If type = "where"
:
the nodes the cases reach.
A. Truong
Truong. A (2009) Fast Growing and Interpretable Oblique Trees via Probabilistic Models
Ripley, B. D. (1996). Pattern Recognition and Neural Networks. Cambridge University Press, Cambridge. Chapter 7.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #grow an oblique tree to the Pima Indian dataset
data(Pima.tr, package = "MASS")
ob.tree <- oblique.tree(formula = type~.,
data = Pima.tr,
oblique.splits = "on")
plot(ob.tree);text(ob.tree);title(main="Oblique Tree")
#predictions to in-sample data
#class probabilities for each observation
predict(ob.tree,type="vector")
#the tree itself
predict(ob.tree,type="tree")
#class predictions for each observation
predict(ob.tree,type="class")
#the leaf where each observation falls
predict(ob.tree,type="where")
#predictions to out-of-sample data
data(Pima.te, package = "MASS")
#class probabilities for each observation
predict(ob.tree,newdata=Pima.te,type="vector")
#the tree itself
predict(ob.tree,newdata=Pima.te,type="tree")
#class predictions for each observation
predict(ob.tree,newdata=Pima.te,type="class")
#the leaf where each observation falls
predict(ob.tree,newdata=Pima.te,type="where")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.