{"id":23076,"library":"dtreeviz","title":"dtreeviz: Decision Tree Visualization","description":"A Python 3 library for visualizing decision trees from scikit-learn, XGBoost, LightGBM, Spark, and TensorFlow. Version 2.3.2 supports AI chat integration for sklearn, categorical variables, and various tree model backends. Releases are frequent, approximately every few months.","status":"active","version":"2.3.2","language":"python","source_language":"en","source_url":"https://github.com/parrt/dtreeviz","tags":["decision tree","visualization","sklearn","xgboost","lightgbm","tensorflow"],"install":[{"cmd":"pip install dtreeviz","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The main function is inside the dtreeviz module. Using 'import dtreeviz' then calling dtreeviz.dtreeviz(...) is also valid but less common.","wrong":"import dtreeviz","symbol":"dtreeviz","correct":"from dtreeviz import dtreeviz"},{"note":"","wrong":"","symbol":"model","correct":"from sklearn.tree import DecisionTreeRegressor"}],"quickstart":{"code":"from sklearn.datasets import load_diabetes\nfrom sklearn.tree import DecisionTreeRegressor\nfrom dtreeviz import dtreeviz\n\ndiabetes = load_diabetes()\nX = diabetes.data\ny = diabetes.target\n\nregr = DecisionTreeRegressor(max_depth=3)\nregr.fit(X, y)\n\nviz = dtreeviz(regr, X, y, target_name='diabetes', feature_names=diabetes.feature_names)\nviz.view()","lang":"python","description":"Train a simple decision tree regressor and visualize it with dtreeviz."},"warnings":[{"fix":"Update function calls to match new signatures. Refer to changelog for specific changes.","message":"Version 2.1.0 introduced a major refactoring. Functions like 'ctree_feature_space' changed signature; older code may break.","severity":"breaking","affected_versions":"<2.1.0 → >=2.1.0"},{"fix":"Upgrade to >=2.2.0 or encode categories as integers before fitting.","message":"When using categorical features, ensure they are numeric-encoded. dtreeviz does not handle string categories natively in older versions; supported from 2.2.0 onward.","severity":"gotcha","affected_versions":"<2.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade dtreeviz to >=2.2.1 or pin numpy to a compatible version.","cause":"Incompatibility with newer versions of numpy or other dependencies, fixed in 2.2.1.","error":"TypeError: dict() argument after ** must be a mapping, not float"},{"fix":"Upgrade dtreeviz to >=2.1.0.","cause":"Bug in version 2.0.x, fixed in 2.1.0.","error":"KeyError when using decision_boundaries function"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}