So I'm working on a project with decision trees, and I need to know how to get the percentages for each of the nodes.
Here is my approximate code:
fit <- rpart(Y ~ a + b + c, method = "class", data = example, control = rpart.control(minsplit=5))
My main question is how do I get the percentage estimation for each of the rows in example from the rpart output.
I have looked at the answer given in the following post How to get percentages from decision tree for each node, and from my understanding (please correct me if I'm wrong), 33.3% of the data belong in class 2, 36% in class 4, and 30.67% in class 5. But what my question differs is that I need to know is what is the percent chance of an entry being in class 2, what percent chance in class 4, etc.
Any help is appreciated. Thanks!