【dtreeviz ‘module‘ object is not callable 解决方案】dtreeviz python

主要原因,函数调用错误

dtreeviz 安装使用

参考链接

报错部分的代码

【dtreeviz ‘module‘ object is not callable 解决方案】dtreeviz python_第1张图片

报错

'module' object is not callable  
# 模块当作类、函数调用了

解决方案

参考链接
【dtreeviz ‘module‘ object is not callable 解决方案】dtreeviz python_第2张图片
导入模块是使用语句

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()              

仔细研究完整示例代码!!!

你可能感兴趣的:(python,机器学习,python,dtreeviz,module,决策树绘图,决策树)