parrt / dtreeviz

A python library for decision tree visualization and model interpretation.
MIT License
2.89k stars 332 forks source link

AttributeError: module 'dtreeviz' has no attribute 'model' on Windows platform, works fine on Google colab #311

Open sabya39 opened 7 months ago

sabya39 commented 7 months ago

Getting AttributeError: module 'dtreeviz' has no attribute 'model' when executing the README code below

from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier

import dtreeviz

iris = load_iris() X = iris.data y = iris.target

clf = DecisionTreeClassifier(max_depth=4) clf.fit(X, y)

viz_model = dtreeviz.model(clf, X_train=X, y_train=y, feature_names=iris.feature_names, target_name='iris', class_names=iris.target_names)

v = viz_model.view() # render as SVG into internal object v.show() # pop up window v.save("/tmp/iris.svg") # optionally save as svg In a notebook, you can render inline without calling show(). Just call view():

viz_model.view() # in notebook, displays inline