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

后端 未结 2 423
野趣味
野趣味 2021-01-04 18:29

When I run mean_acc() method in my program, there are % (min_groups, self.n_splits)), Warning) errors...

def mean_acc():
    models = [
        RandomForestC         


        
相关标签:
2条回答
  • 2021-01-04 18:49

    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.
    
    0 讨论(0)
  • 2021-01-04 18:59

    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')
    
    0 讨论(0)
提交回复
热议问题