此警告弹出10次。行号在456和305之间变化:
C:\Users\foo\Anaconda3\lib\site-packages\scipy\optimize\_linesearch.py:456: LineSearchWarning: The line search algorithm did not converge
warn('The line search algorithm did not converge', LineSearchWarning)
我正在用这些参数进行网格搜索:
logistic_regression_grid = {
"class_weight": ["balanced"],
"max_iter": [100000],
"solver": ["lbfgs", "liblinear", "newton-cg", "newton-cholesky", "sag", "saga"],
"random_state": [0]
}
所以,问题是哪个求解器抛出了警告?有可能确定吗?
1条答案
按热度按时间vfhzx4xs1#
我使用了虹膜集,并设置了
max_iter=10
,以有意地引发收敛警告。由于您只对解算器感兴趣,我在解算器上循环,而不使用网格搜索,并且我能够使用warnings
库和sklearn.exceptions
包打印解算器不收敛。以下是我的代码:下面是我得到的输出: