.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code or to run this example in your browser via Binder
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_examples_miscellaneous_plot_changed_only_pprint_parameter.py:
=================================
Compact estimator representations
=================================
This example illustrates the use of the print_changed_only global parameter.
Setting print_changed_only to True will alternate the representation of
estimators to only show the parameters that have been set to non-default
values. This can be used to have more compact representations.
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
Default representation:
LogisticRegression(penalty='l1')
With changed_only option:
LogisticRegression(penalty='l1')
|
.. code-block:: default
print(__doc__)
from sklearn.linear_model import LogisticRegression
from sklearn import set_config
lr = LogisticRegression(penalty='l1')
print('Default representation:')
print(lr)
# LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,
# intercept_scaling=1, l1_ratio=None, max_iter=100,
# multi_class='auto', n_jobs=None, penalty='l1',
# random_state=None, solver='warn', tol=0.0001, verbose=0,
# warm_start=False)
set_config(print_changed_only=True)
print('\nWith changed_only option:')
print(lr)
# LogisticRegression(penalty='l1')
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.002 seconds)
.. _sphx_glr_download_auto_examples_miscellaneous_plot_changed_only_pprint_parameter.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: binder-badge
.. image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/scikit-learn/scikit-learn/0.23.X?urlpath=lab/tree/notebooks/auto_examples/miscellaneous/plot_changed_only_pprint_parameter.ipynb
:width: 150 px
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_changed_only_pprint_parameter.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_changed_only_pprint_parameter.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_