Jupyter 实验室未打印 sklearn 模型的所有参数 [英] Jupyter lab is not printing all parameters form sklearn model

查看:153
本文介绍了Jupyter 实验室未打印 sklearn 模型的所有参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 jupyter 实验室几个月了,每次运行 sklearn 模型时,输出都是这样的:

I've been using jupyter lab for several month and every time I run a sklearn model the output is like this:

from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(criterion="entropy", max_depth = 4)
clf 

过去显示此输出:

DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='entropy',
                      max_depth=4, max_features=None, max_leaf_nodes=None,
                      min_impurity_decrease=0.0, min_impurity_split=None,
                      min_samples_leaf=1, min_samples_split=2,
                      min_weight_fraction_leaf=0.0, presort='deprecated',
                      random_state=None, splitter='best')

但现在它只显示我实际设置的参数:

But now it only shows the params that I have actually set:

DecisionTreeClassifier(criterion='entropy', max_depth=4)

有谁知道如何让 Jupyter 再次显示完整的参数列表?

Anyone knows how to make Jupyter show the complete list of params again?

推荐答案

它是 0.23 版本中名为 print_only_changed 的新功能.所以不要向下滚动到以前的版本,只需将 print_only_changed 选项设置为 False.

It is the new feature called print_only_changed in the version 0.23. So don't roll down to previous version, just set the print_only_changed option as False.

from sklearn import set_config
from sklearn.tree import DecisionTreeClassifier

clf = DecisionTreeClassifier(criterion="entropy", max_depth = 4)

set_config(print_changed_only=True)
clf 
# DecisionTreeClassifier(criterion='entropy', max_depth=4)

set_config(print_changed_only=False)
clf 
# DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='entropy',
#                        max_depth=4, max_features=None, max_leaf_nodes=None,
#                        min_impurity_decrease=0.0, min_impurity_split=None,
#                        min_samples_leaf=1, min_samples_split=2,
#                        min_weight_fraction_leaf=0.0, presort='deprecated',
#                        random_state=None, splitter='best')

这篇关于Jupyter 实验室未打印 sklearn 模型的所有参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆