# How to further Interpret Variable Importance?

Forgive me if this is a duplicate question, I haven't found anything that answers my question specifically after searching for a while.

I have a dataset which I'm using to predict mobile app user retention, using the RandomForestClassifier in the SciKit Learn package. I'm pleased with the accuracy I'm getting and I'm planning on including a number of other metrics including precision, recall, Matthew's Corr Coefficient etc. I'm pretty sure the model is good.

The key thing that I'm interested in here are the features themselves. I want to know what is contributing to my user churn. I have extracted the feature importances and plotted a nice looking graph, but now I'm stuck. I'd ideally like to know how each variable influences the churned/not churned outcome. The problem with GINI feature importances is that I can see which ones are most influential, but for example with continuous variables I want to know at which value the RF found best to split on. I don't need to see this for every feature as I have 70+ only the most 'important' ones.

I saw a very nice decision tree plot here, but cannot find any way of reproducing something similar using scikit learn. I'm open to other suggestions. Thanks in advance :)

• stackoverflow.com/questions/40155128/… – Hobbes Jun 20 '17 at 22:48
• It's also in the documentation. If your forest is big, you're probably better off with partial dependence plots instead of looking at every node in every tree. – oW_ Jun 20 '17 at 23:17
• @oW_ That's absolutely perfect! Just what I'm looking for! The doc even says it should be used with ideally 1 to 2 features selected from Variable Importance metrics. So this is an ideal next step. If you'd write up an answer, I will happily mark it as accepted :) – Dan Carter Jun 22 '17 at 10:22

The documentation offers a couple options. To plot the individual trees in your forest, one can access them like model.estimators_[n].tree_ and then plot them with export_graphviz as explained in the documentation, or you can follow this example that directly prints the structure in text format.