[ot-users] Discrete distribution

roy roy at cerfacs.fr
Wed Nov 8 14:14:04 CET 2017


Hi everyone,

I was looking at a way to have discrete distribution.
From the doc there is no discrete distribution (or I missed it) so I wanted to use scipy’s distributions
and wrap them with ot.SciPyDistribution. But with randint I got this issue :

>>> ot.SciPyDistribution(randint)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/roy/Applications/miniconda3/envs/batman3/lib/python3.6/site-packages/openturns/model_copula.py", line 3047, in __init__
    raise TypeError('Argument is not a scipy distribution')
TypeError: Argument is not a scipy distribution

I tried commenting the raise and it seems to work as I expected. But I suppose the raise is here for a reason.

Until then I am using this:

from scipy.stats import randint
import openturns as ot

rv = randint(10, 20)
points = ot.Sample(10000, 1)
for i in range(10000):
    points[i] = (rv.rvs(),)

disc_dist = ot.UserDefined(points)

Thanks.

Sincerely,

Pamphile ROY
Chercheur doctorant en Quantification d’Incertitudes
CERFACS - Toulouse (31) - France
+33 (0) 5 61 19 31 57
+33 (0) 7 86 43 24 22



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openturns.org/pipermail/users/attachments/20171108/a3d4b2b9/attachment.html>


More information about the users mailing list