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)

完美显示如下的决策树:

 

可以看出特征和类别标签不是调的关系哦。

 

posted @ 2019-11-19 18:36  赏尔  阅读(734)  评论(0)    收藏  举报