mglearn 学习决策树, display(tree) 报错
1、调用 mglearn 的模型
import mglearn
%matplotlib notebook
tree = mglearn.plots.plot_tree_not_monotone()
display(tree)

2、需要从 IPython.display 模块中导入 display() 函数
import mglearn from IPython.display import display %matplotlib notebook tree = mglearn.plots.plot_tree_not_monotone() display(tree)
完美显示如下的决策树:

可以看出特征和类别标签不是调的关系哦。
非学无以广才,非志无以成学。

浙公网安备 33010602011771号