Hi Julien,

Thank you for your reply. However, shouldn't the quantiles of continuous 
unbounded distributions at p=0 and p=1 be undefined and return NaN (or -/+inf 
if we consider the limits)? What is the purpose of real-numbered boundary 
values in these cases? If this is a coding convenience, then why does 
ot.Normal().computeQuantile() not return quantiles that are symmetric about 0 
for ot.SpecFunc.MinScalar and 1-ot.SpecFunc.Precision?

Phil


From: [email protected] [mailto:[email protected]] On 
Behalf Of Julien Schueller | Phimeca
Sent: Monday, September 04, 2017 9:37 AM
To: [email protected]
Subject: [External] Re: [ot-users] Nonsensical output from computeQuantile


Maybe we don't want to throw, but I'm not sure.
We never throw, but there are some other cases where the quantile function is 
not really continuous at the bounds, because in 
DistributionImplementation::computeQuantile(L2063) we filter according to the 
values defined in the range attribute:





import openturns as ot
import traceback

factories = ot.DistributionFactory.GetUniVariateFactories()
for factory in factories:
    dist = factory.build()
    try:
        q0 = dist.computeQuantile(0.0)
        qm1 = dist.computeQuantile(-1.0)
        if q0 != qm1:
            print(dist.getName(), '<0', q0, qm1)
        q1 = dist.computeQuantile(1.0)
        q0p = dist.computeQuantile(ot.SpecFunc.MinScalar)
        if q0 != q0p:
            print(dist.getName(), '0+', q0, q0p)
    except:
        print(' exc for', dist.getName())
        traceback.print_exc()
        pass

    try:
        q1 = dist.computeQuantile(1.0)
        q2 = dist.computeQuantile(2.0)
        if q1 != q2:
            print(dist.getName(), '>1', q1, q2)
        q1m = dist.computeQuantile(1.0-ot.SpecFunc.ScalarEpsilon)
        if q1m != q1:
            print(dist.getName(),'1-', q1m, q1)
    except:
        print(' exc for', dist.getName())
        traceback.print_exc()
        pass

________________________________
De : [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> de la part de 
Julien Schueller | Phimeca <[email protected]<mailto:[email protected]>>
Envoyé : lundi 4 septembre 2017 16:40:25
À : [email protected]<mailto:[email protected]>
Objet : Re: [ot-users] Nonsensical output from computeQuantile


Hello Phil,



- Calling computeQuantile(x) with p outside of (0,1) does not make sense as x 
is a probability, and it should throw an exception, maybe we should fix that.



- Otherwise the boundary values at x=0 and x=1 seem perfectly fine, (and should 
not be -/+inf) regarding the continuity of the fonction:

In [32]: ot.Normal().computeQuantile(ot.SpecFunc.MinScalar)
Out[32]: class=Point name=Unnamed dimension=1 values=[-37.5016]

In [42]: ot.Normal().computeQuantile(1-ot.SpecFunc.Precision)
Out[42]: class=Point name=Unnamed dimension=1 values=[8.12589]


j

________________________________
De : [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> de la part de 
Phil Fernandes <[email protected]<mailto:[email protected]>>
Envoyé : mercredi 23 août 2017 22:37:37
À : [email protected]<mailto:[email protected]>
Objet : [ot-users] Nonsensical output from computeQuantile

Hello,

I've noticed that the computeQuantile function, at least for continuous 
unbounded distributions, yields a nonsensical numerical result with inputs <=0 
and >=1. For example, ot.Normal().computeQuantile(x) when x = 0 the output is 
-37.5194. If I enter x < 0, the output is -7.65063. At the moment I am handling 
this by subclassing the distribution and overriding the computeQuantile method 
with an if-else statement that returns -np.inf or np.inf if x = 0 or 1, but 
this is cumbersome. Would it be possible to incorporate this fix into the 
source code?

Thank you,
Phil
_______________________________________________
OpenTURNS users mailing list
[email protected]
http://openturns.org/mailman/listinfo/users

Reply via email to