Solved – How the class probabilities are calculated in classification tree

cartclassificationmachine learningprobabilityr

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?

Best Answer

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.