Christoph Deil <deil.christ...@googlemail.com> added the comment:

The Monte Carlo example here has completely unstable results:

https://github.com/python/cpython/commit/cc353a0cd95d9b0c93ed0b60ba762427a94c790d#diff-d436928bc44b5d7c40a8047840f55d35R633

If you run it multiple times, you will see that `mean` is relatively stable, 
but `stddev` varies from 10 to 50 to 100. The reason is that in the model 
there's a division by z, and the z distribution used has values arbitrarily 
close to zero:

>>> NormalDist(5, 1.25).cdf(0) * 100_000
3.16

Suggest to change to a MC sampling example that isn't as pathological, doesn't 
involve division by zero. E.g. change the mean of z to 50, or reduce the stddev 
to 0.125 or some such change in parameters.

Usually in stats or machine learning books and docs e.g. on statsmodels or 
scikit-learn etc., for methods where random numbers are involved, the seed is 
always set to a fixed value, to have reproducible results & docs. Suggest to 
make that change also here.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37905>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to