Skip to content
Advertisement

How to hide `delta_grad == 0.0` warning in scipy.optimize.minimize?

I have a loop that executes several hundred optimizations using scipy.optimize.minimize. Unfortunately, I keep getting this annoying warning:

JavaScript

Because I am running hundreds of optimizations, this warning shows up dozens and dozens of times during the loop, and it just clutters the console and obscures the rest of my program’s output. Is there a way to either

  1. Check if this warning has already been displayed, and if so don’t display it again, OR
  2. Completely suppress the warning altogether?

Advertisement

Answer

If you want to suppress the specific warning, you can add following at the beginning of your script:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement