Visualize Random Forest Model

Hello Knime Community

I have created multiple decision models with the Random Forest Node. To present this in front of people or document this in a paper I need to extract the decision model itself somehow. Is there a way to extract the model in any way (other then PMML)?

The Model Viewer (of a random forest learner node) in Knime does pretty much what I am trying to achieve but there is no way to extract the ruleset, at least I didn’t find one.

Is there a way to achieve something like mentioned here (decision tree view)?

If not, does any body know of a solution that could do this to a PMML file?

Thanks :slight_smile:

Hello Michael,

actually there are quite a few ways to achieve what want:

  1. The Random Forest Learner provides a view itself
  2. In order to get the view you linked to, you can use the following workflow:

    Note that the Cell to PMML node only converts the first cell in the table to PMML.
    The second view of the Decision Tree Predictor is the one you were referring to.
  3. If you want to extract a rule set, you can also use the Decision Tree to Ruleset node on the PMML you get from the Cell to PMML node.

I’d like to add a disclaimer that I feel is necessary: The trees in Random Forests are not as interpretable as vanilla decision trees for a couple of reasons:

  • Each tree is built on a random bootstrap sample of the training data
  • Each split in each tree considers only a random sample of the attributes
  • The trees are not pruned i.e. they usually achieve 100% accuracy on their sample of the training data

One consequence of the above is that the trees tend to be very big and degenerate (i.e. not balanced) and rule sets extracted from them share the same properties (plus most rules will usually have a very small support).
Random forests are great predictors but this is mostly due to their ensemble nature which makes them very complex and very hard to interpret.

Hope that helps,

nemad