Leo*_*das 3 python warnings scipy scipy-optimize scipy-optimize-minimize
我有一个循环,使用 scipy.optimize.minimize 执行数百次优化。不幸的是,我不断收到这个恼人的警告:
C:\Users\Leonidas\Anaconda3\lib\site-packages\scipy\optimize\_hessian_update_strategy.py:186: UserWarning: delta_grad == 0.0. Check if the approximated function is linear. If the function is linear better results can be obtained by defining the Hessian as zero instead of using quasi-Newton approximations.
'approximations.', UserWarning)
Run Code Online (Sandbox Code Playgroud)
因为我正在运行数百次优化,所以这个警告在循环期间出现了几十次,它只会使控制台变得混乱并掩盖程序输出的其余部分。有没有办法
如果您想抑制特定警告,可以在脚本开头添加以下内容:
import warnings
warnings.filterwarnings("ignore", message="delta_grad == 0.0. Check if the approximated function is linear.")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2114 次 |
| 最近记录: |