1
$\begingroup$

I am working on classification problem where I need to categorize the user in buy/ non-buy category. I have around 100 + features or predictors to predict the behavior of user.

I tried to implement with Random forest and Gradient Boosting to get better prediction compare to decision tree. I am getting better performance when I evaluate against performance parameters like roc_auc,accuracy, precision and recall when using ensemble techniques.

I also extracted important features that are responsible for my predictions but I am not able to visualize the model fully. Some how random forest works as black box where i am not getting what is the contribution of each tree, which features are been considered in each trees, etc.

Is there any way through which I can find out more information from Random Forest Model?

$\endgroup$
1
  • $\begingroup$ You surely don't want to visualize a RF with 100+ feats and a bigger depth... $\endgroup$
    – Aditya
    Oct 9, 2018 at 13:15

2 Answers 2

1
$\begingroup$

You can try SHAP which visually explains the output of (many) machine learning model(s) including LightGBM and XGBoost.

However, please note that it will not give you the entire Ensemble Model (Trees) as picture.
Further note that it doesn't work for RandomForest

$\endgroup$
1
  • $\begingroup$ Seems like SHAP can be of use to derive the meaning of each feature in your model. Thanx $\endgroup$ Oct 10, 2018 at 9:56
0
$\begingroup$

If you are working in python, sklearn allows you to export a decision tree in DOT format.

The documentation can be found here

from sklearn.tree import export_graphviz
export_graphviz(decision_tree, out_file=None, max_depth=None, feature_names=None, class_names=None, label=’all’, filled=False, leaves_parallel=False, impurity=True, node_ids=False, proportion=False, rotate=False, rounded=False, special_characters=False, precision=3)

There is, also, a helpful guide to extract the result in png

$\endgroup$
1
  • $\begingroup$ It is easy to visualize decision tree.I used this approach for decision tree but I am interested in visualizing few tress(if not full) generated from random forest. $\endgroup$ Oct 10, 2018 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.