How do I solve the future warning -> % (min_groups, self.n_splits)), Warning) in python?

≡放荡痞女 提交于 2019-12-05 03:26:01

If you want to ignore it, add the following to your code at the top:

import warnings
warnings.filterwarnings("ignore", category=FutureWarning)

Else specify solver as so:

LogisticRegression(solver='lbfgs')

Source:

solver : str, {‘newton-cg’, ‘lbfgs’, ‘liblinear’, ‘sag’, ‘saga’}, default: ‘liblinear’.
Algorithm to use in the optimization problem.

For small datasets, ‘liblinear’ is a good choice, whereas ‘sag’ and ‘saga’ are faster for large ones.
For multiclass problems, only ‘newton-cg’, ‘sag’, ‘saga’ and ‘lbfgs’ handle multinomial loss; ‘liblinear’ is limited to one-versus-rest schemes.
‘newton-cg’, ‘lbfgs’ and ‘sag’ only handle L2 penalty, whereas ‘liblinear’ and ‘saga’ handle L1 penalty.

If you are using Logistic Regression Model having penalty='l1' as hyper-parameter you can use solver='liblinear'

My Code sample::

logistic_regression_model=LogisticRegression(penalty='l1',dual=False,max_iter=110, solver='liblinear')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!