[ot-users] Discrete distribution

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


Hi Julien,

OK thanks for the precision. Indeed, this could be highlighted (as in scipy’s documentation).

So if I read all this correctly, there is currently no other way than use ot.UserDefined as I am doing to do a uniform discrete distribution.
I tried ot.Multinomial but the api is not very clear. If I get it right this could do the job but would require some rescaling if I want specific bounds.

Thanks.

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



> Le 8 nov. 2017 à 14:27, Julien Schueller | Phimeca <schueller at phimeca.com> a écrit :
> 
> Hi Roy,
> 
> There are several discrete distributions:
> - Poisson
> - Binomial
> - Multinomial
> - Dirac
> - Geometric
> - Skellam
> - Bernoulli
> - NegativeBinomial
> - UserDefined
> - ZipfMandelbrot
> 
> Maybe they should be highlighted in the doc.
> 
> j
> De : users-bounces at openturns.org <users-bounces at openturns.org> de la part de roy <roy at cerfacs.fr>
> Envoyé : mercredi 8 novembre 2017 14:14:04
> À : users
> Objet : [ot-users] Discrete distribution
>  
> 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
> 
> 
> 
> _______________________________________________
> OpenTURNS users mailing list
> users at openturns.org <mailto:users at openturns.org>
> http://openturns.org/mailman/listinfo/users <http://openturns.org/mailman/listinfo/users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openturns.org/pipermail/users/attachments/20171108/cf5e879e/attachment.html>


More information about the users mailing list