Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'invalid value encountered in double_scalars' warning, possibly numpy

As I run my code I get these warnings, always in groups of four, sporadically. I have tried to locate the source by placing debug messages before and after certain statements to pin-point its origin.

Warning: invalid value encountered in double_scalars Warning: invalid value encountered in double_scalars Warning: invalid value encountered in double_scalars Warning: invalid value encountered in double_scalars 

Is this is a Numpy warning, and what is a double scalar?

From Numpy I use

min(), argmin(), mean() and random.randn() 

I also use Matplotlib

like image 266
Theodor Avatar asked Sep 22 '10 08:09

Theodor


People also ask

What does invalid value encountered in double_scalars mean?

One error you may encounter in Python is: runtimewarning: invalid value encountered in double_scalars. This error occurs when you attempt to perform some mathematical operation that involves extremely small or extremely large numbers and Python simply outputs a NaN value as the result.

What is double scalars?

A double scalar is a value of type double . It is called scalar to differentiate it in numpy from double arrays.


1 Answers

In my case, I found out it was division by zero.

like image 127
Volod Avatar answered Oct 25 '22 06:10

Volod