FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.
消除警告方法
-
import warnings warnings.filterwarnings("ignore")
-
from warnings import simplefilter simplefilter(action='ignore', category=FutureWarning)
具体出现原因
LogisticRegression(solver='lbfgs')
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.