How to get probabilites out of Decision Tree and Naives Bayes


ist there a way to not only get the predicted class, but also the probability that object belongs to the predicted class.

Thank you


Hi Andra,

The decision values at each node are encoded in PMML, which is an XML format. Are you proficient with XML? If so, use the PMML To Cell node to convert the model to XML. Then use the various XML nodes (e.g. XPath) to extract the values. 

Here's a forum thread where a user created a metanode to extract values from a decision tree and write them to a CSV file :

Hope this helps,


In the Predictor node, simply tag the box containing sth like "class distribution". The result will be a probability column per class for each observation, the name of each column will be the class plus the suffix that you have specified with the aforementioned option. Should the suffix be unique in your column list, then you can even easily select the proba columns using a wildcard or regex at a later stage.



sorry for my late reply! I didn`t realize that somebody answered...


Thank you dnaki and Geo for your answers!

Unfortunately I do not know any xml, but I will look at the thread and try to apply the solution nevertheless.

Geos solution seems to be a little bit easier. I will try that too!




What Geo proposed is exactly what I was looking for. Thanks!

I am, however, a little bit confused about the results.

I try to predict if a customer of a Website buys something at the end or not (order/no order). 

There are some observations where the predictor predicts "order" with a probability of 100%. However, the prediction ist wrong. The correct class is "no order". How can the probability be 100% then?