Example to illustrate the use of the print changes only global parameter in Python

0 votes
Can you please give an example to illustrate the use of the print_changes_only global parameter in Python?
Jun 3, 2019 in Python by Vish

1 answer to this question.

0 votes

Hi @Vish, First of all, the parameter is called print_changed_only and not print_changes_only.

Setting this parameter to True will change the representation of estimators to only show the parameters that have been set to non-default values.

Have a look at the following example:


from sklearn.linear_model import LogisticRegression
from sklearn import set_config

lr = LogisticRegression(penalty='l1')
print('Default representation:')
# LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,
#                    intercept_scaling=1, l1_ratio=None, max_iter=100,
#                    multi_class='warn', n_jobs=None, penalty='l1',
#                    random_state=None, solver='warn', tol=0.0001, verbose=0,
#                    warm_start=False)

print('\nWith changed_only option:')
# LogisticRegression(penalty='l1')
answered Jun 3, 2019 by Mohit

Related Questions In Python

+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by aryya
• 7,440 points
0 votes
1 answer

When to use %r instead of %s in Python? [duplicate]

The %s specifier converts the object using ...READ MORE

answered Aug 2, 2018 in Python by bug_seeker
• 15,550 points
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,179 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
0 votes
1 answer

What is the procedure to find the exact path of python installation in Windows?

This is a very simple thing to ...READ MORE

answered Aug 26, 2019 in Python by Neel
• 3,020 points