Message350094
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. |
|
Date |
User |
Action |
Args |
2019-08-21 16:36:38 | Christoph.Deil | set | recipients:
+ Christoph.Deil, rhettinger, mark.dickinson, steven.daprano |
2019-08-21 16:36:38 | Christoph.Deil | set | messageid: <1566405398.61.0.865137090876.issue37905@roundup.psfhosted.org> |
2019-08-21 16:36:38 | Christoph.Deil | link | issue37905 messages |
2019-08-21 16:36:38 | Christoph.Deil | create | |
|