0
$\begingroup$

I created a classification tree and predicted the class probabilities in r. Now iam asking myself how this values are calculated maybe you have an intuition?

$\endgroup$
  • 1
    $\begingroup$ It depends on the method. Which method did you use to construct your classification tree? Have you consulted the documentation and its cited works? $\endgroup$ – Sycorax says Reinstate Monica Jun 24 '19 at 21:38
  • $\begingroup$ @Sycorax I used the rpart package in r which is based on the cart algorithm. I searched in the vignette of the package cran.r-project.org/web/packages/rpart/vignettes/longintro.pdf but didnt find anything about it. $\endgroup$ – MasterStudent1992 Jun 24 '19 at 21:40
  • 1
    $\begingroup$ Vignettes are useful to show the gist of what a package does, but it is not the same as the comprehensive documentation. For example, if you turn to page 21 of the package documentation, you'll see that the package closely follows the methods from a particular publication. Reading that publication will answer your question. $\endgroup$ – Sycorax says Reinstate Monica Jun 24 '19 at 21:48
3
$\begingroup$

When you use an estimated classification tree for a prediction each observation goes through the tree from top to bottom until it reaches a "leaf", i.e. a node which is not split into other nodes any more. When you were estimating the tree on the training dataset in each of these leaves there were some observations from each of the class. The predicted class probabilities are simply the class proportions from the estimation phase in the leaf which your observation being predicted reached.

You can check these probabilities using summary() function on your tree object.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.