vendredi 26 février 2016

numpy.random.exponential(scale=1.0) returns numbers greater than 1

Unless I've gone completely insane, the documentation for numpy.random.exponential()

http://ift.tt/1OBOz73

suggests that setting the scale parameter to 1.0 should guarantee that function calls return a number between 0.0 and 1.0, since it is only defined for x > 0.

I've graphed it on wolfram alpha to verify I'm not going insane and it does range from 0 to 1.

http://ift.tt/1TcMkj5

I also tried both numpy.random.exponential() since the default argument is 1.0 and numpy.random.standard_exponential(), but both sometimes give me values greater than 1.

I feel like I've made some silly mistake in my understanding but cannot find it. Any help would be greatly appreciated.

Example code that I ran:

import numpy as np
print np.random.exponential(scale=1.0)

Example returned value:

1.56783951494




Aucun commentaire:

Enregistrer un commentaire