rxDTree: How to return the computed class probabilites

You need to pass the output from rxDTree() to rxPredict()(using 'type' = 'prob') to get the class probabilities for each observation in your dataset.

Here is a quick example using the 'iris' dataset:

# classification 
iris.sub <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25)) 
iris.dtree <- rxDTree(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, 
data = iris[iris.sub, ], cp = 0.01) 
iris.dtree

rxPredict(iris.dtree, iris[-iris.sub, ], type = "prob")
Properties

Article ID: 3104221 - Last Review: 29 Oct 2015 - Revision: 1

Feedback