主要原因,函数调用错误
dtreeviz 安装使用
报错部分的代码
报错
'module' object is not callable
# 模块当作类、函数调用了
解决方案
参考链接
导入模块是使用语句
from dtreeviz.trees import *
完整的示例代码
from sklearn.datasets import *
from sklearn import tree
from dtreeviz.trees import *
regr = tree.DecisionTreeRegressor(max_depth=2)
boston = load_boston()
regr.fit(boston.data, boston.target)
viz = dtreeviz(regr,
boston.data,
boston.target,
target_name='price',
feature_names=boston.feature_names)
viz.view()