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
Which in the past showed this output:
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)
Anyone knows how to make Jupyter show the complete list of params again?
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')
Other than downgrading sklearn or editing the source code, I would say you can just use:
clf.get_params()
{'ccp_alpha': 0.0,
'class_weight': None,
'criterion': 'gini',
'max_depth': None,
'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': 0,
'splitter': 'best'}
See the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With