gpt4 book ai didi

python - Jupyter 实验室未打印 sklearn 模型的所有参数

转载 作者:行者123 更新时间:2023-12-04 02:33:43 26 4
gpt4 key购买 nike

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

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')
但现在它只显示我实际设置的参数:
DecisionTreeClassifier(criterion='entropy', max_depth=4)
有人知道如何让 Jupyter 再次显示完整的参数列表吗?

最佳答案

这是名为 print_only_changed 的新功能在 0.23 版本中。所以不要向下滚动到以前的版本,只需设置print_only_changed选项为 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')

关于python - Jupyter 实验室未打印 sklearn 模型的所有参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62825515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com