Skip to content

Conversation

@oleksandr-pavlyk
Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk commented Feb 9, 2021

@samir-nasibli

This fixes incorrect sampling in Wald, a.k.a Inverse Gaussian distribution.

(mkl_random_dev) [16:32:33 lin03 mkl_random]$ ipython
Python 3.6.8 |Intel Corporation| (default, Apr 12 2019, 17:34:58)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import mkl_random, numpy as np

In [2]: wald_sample = mkl_random.wald(mean=14, scale=15, size=5*10**6)

In [3]: np.mean(wald_sample)
Out[3]: 14.007203796988938

In [4]: np.var(wald_sample)
Out[4]: 183.2745041415038

In [5]: np.mean(np.logical_and(13 < wald_sample, wald_sample < 17))
Out[5]: 0.1069688

All sample expectations agree with population expectations.

@oleksandr-pavlyk oleksandr-pavlyk merged commit 7d120b0 into master Feb 10, 2021
@oleksandr-pavlyk oleksandr-pavlyk deleted the bugfix/wald branch February 10, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant