1

I keep getting this error when using numpy:

Warning (from warnings module):
  File "somepath.py", line 249
    return 1 / ( 1 + np.exp( -x))
RuntimeWarning: overflow encountered in exp

However this doesn't tell me anything, as I still have no idea how it got to this error. Usually when I get an error it traces back through the functions it went through to get to the error, but not with exp overflow.

How do I get an error in which it does show me this?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Perm. Questiin
  • 429
  • 2
  • 9
  • 21
  • please refer http://stackoverflow.com/questions/9559346/deal-with-overflow-in-exp-using-numpy – JkShaw Apr 26 '17 at 14:29

1 Answers1

2

You can ask Python to turn the warning into an error:

import warnings    
warnings.filterwarnings("error", category=RuntimeWarning)

(Docs)

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135