[R] treemind: A High-Performance Library for Explaining Tree-Based Models


I am pleased to introduce treemind, a high-performance Python library for interpreting tree-based models.

Whether you're auditing models, debugging feature behavior, or exploring feature interactions, treemind provides a robust and scalable solution with meaningful visual explanations.

  • Feature Analysis Understand how individual features influence model predictions across different split intervals.
  • Interaction etection Automatically detect and rank pairwise or higher-order feature interactions.
  • Model Support Works seamlessly with LightGBM, XGBoost, CatBoost, scikit-learn, and perpetual.
  • Performance Optimized Fast even on deep and wide ensembles via Cython-backed internals.
  • Visualizations Includes a plotting module for interaction maps, importance heatmaps, feature influence charts, and more.

Installation

pip install treemind

One-imensional Feature Explanation

Each row in the table shows how the model behaves within a specific range of the selected feature.
The value column represents the average prediction in that interval, making it easier to identify which value ranges influence the model most.

| worst_texture_lb | worst_texture_ub |   value   |   std    |  count  |
|------------------|------------------|-----------|----------|---------|
| -inf             | 18.460           | 3.185128  | 8.479232 | 402.24  |
| 18.460           | 19.300           | 3.160656  | 8.519873 | 402.39  |
| 19.300           | 19.415           | 3.119814  | 8.489262 | 401.85  |
| 19.415           | 20.225           | 3.101601  | 8.490439 | 402.55  |
| 20.225           | 20.360           | 2.772929  | 8.711773 | 433.16  |

Feature Plot

https://preview.redd.it/cbmyl38y7oef1.png?width=1189&format=png&auto=webp&s=5c7657a74bdebf5c51332ddc856f5de3d5583de9

Two imensional Interaction Plot

The plot shows how the model's prediction varies across value combinations of two features. It highlights regions where their joint influence is strongest, revealing important interactions.

https://preview.redd.it/2zb1ra5h8oef1.png?width=943&format=png&auto=webp&s=6b1149795ce202f50f47f0264013eb225e09de2c

Learn More

Feedback and contributions are welcome. If you're working on model interpretability, we'd love to hear your thoughts.

Leave a Reply