{"id":27469,"library":"treeinterpreter","title":"treeinterpreter","description":"A library for interpreting scikit-learn's decision tree and random forest predictions by decomposing predictions into feature contributions. Current version 0.2.3, last updated in 2019 (maintenance mode).","status":"maintenance","version":"0.2.3","language":"python","source_language":"en","source_url":"https://github.com/andosa/treeinterpreter","tags":["interpretability","scikit-learn","random-forest","decision-tree"],"install":[{"cmd":"pip install treeinterpreter","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Required for model objects","package":"scikit-learn","optional":false},{"reason":"Required for array operations","package":"numpy","optional":false}],"imports":[{"wrong":"from treeinterpreter import treeinterpreter as ti","symbol":"treeinterpreter","correct":"import treeinterpreter"}],"quickstart":{"code":"from sklearn.ensemble import RandomForestRegressor\nfrom sklearn.datasets import load_boston\nfrom treeinterpreter import treeinterpreter as ti\n\nboston = load_boston()\nX, y = boston.data, boston.target\nrf = RandomForestRegressor()\nrf.fit(X, y)\nprediction, bias, contributions = ti.predict(rf, X[:1])\nprint('Prediction:', prediction)\nprint('Bias:', bias)\nprint('Feature contributions:', contributions)","lang":"python","description":"Train a random forest on Boston housing data and interpret a single prediction."},"warnings":[{"fix":"Consider alternatives like shap or interpretml for newer scikit-learn.","message":"The library is unmaintained since 2019 and may not work with recent scikit-learn versions (e.g., >0.24). Expect compatibility issues.","severity":"deprecated","affected_versions":">=0.2.3"},{"fix":"Import with alias as shown.","message":"Duplicate naming: the module 'treeinterpreter' contains a function also named 'treeinterpreter'. Use 'from treeinterpreter import treeinterpreter as ti' to avoid confusion.","severity":"gotcha","affected_versions":"all"},{"fix":"Downgrade scikit-learn to <=0.23 or patch the library. Use shap as alternative.","message":"Scikit-learn v0.24+ deprecated certain internal APIs used by treeinterpreter, causing AttributeError: 'ForestClassifier' object has no attribute 'estimators_' (in some contexts).","severity":"breaking","affected_versions":"scikit-learn >=0.24"},{"fix":"Ensure your model is a tree-based ensemble.","message":"The library only supports tree-based models from scikit-learn (RandomForest, ExtraTrees, DecisionTree). Does not work with other models.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.2.3':24 '2019':28 'contribut':21 'current':22 'decis':10,39 'decision-tre':38 'decompos':17 'featur':20 'forest':14,37 'interpret':5,31 'last':25 'learn':8,34 'librari':3 'mainten':29 'mode':30 'predict':15,18 'random':13,36 'random-forest':35 'scikit':7,33 'scikit-learn':6,32 'tree':11,40 'treeinterpret':1 'updat':26 'version':23","created_at":"2026-05-01T17:46:26.005373+00:00","updated_at":"2026-05-01T17:46:26.005373+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/andosa/treeinterpreter","docs":null,"changelog":null,"pypi":"https://pypi.org/project/treeinterpreter/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}