Hi

I am using GEV for classification. Here in the example below, I wanted to check few things like logcdf and cdf works for GenExtreme. Though, now I can able to find logcdf or cdf, some logcdf values are coming -inf (i.e. cdf 0) which should be 0 (i.e. cdf 1).

My Random Variable is GEV(mu = 0, sigma = 1, xi = -0.5). So, range of the RV is (-inf, -1/xi)=(-inf, 2). So, logcdf should come as 0 (i.e. cdf 1) for RV>=2. But see the below example it’s -inf for RV>=2.

Please help to find out what is wrong and how solve it! I could make some conditions for checking and could make 0 to 1 but I will run it inside pm.Model(),this kind of conditions can make it slow. Thank you.

import numpy as np

import pymc as pm

import pymc_experimental.distributions as pmx

rv = pmx.GenExtreme.dist(mu=0, sigma=1, xi=-0.5) # range of x: (-inf, 2)

x = np.array([-100,-50,-40, -30, -10,-5,-2,-1,0,1,1.5,1.7,1.9,1.99,2,3,4,5])

lcdf_gev = pm.logcdf(rv, x)

print(x)

[-100. -50. -40. -30. -10. -5. -2. -1. 0.

1. 1.5 1.7 1.9 1.99 2. 3. 4. 5. ]

print(lcdf_gev.eval())

[-2.601e+03 -6.760e+02 -4.410e+02 -2.560e+02 -3.600e+01 -1.225e+01

-4.000e+00 -2.250e+00 -1.000e+00 -2.500e-01 -6.250e-02 -2.250e-02

-2.500e-03 -2.500e-05 -inf -inf -inf -inf]

print(np.exp(lcdf_gev.eval()))

[0.00000000e+000 2.61174176e-294 2.99318445e-192 6.61626106e-112

2.31952283e-016 4.78511739e-006 1.83156389e-002 1.05399225e-001

3.67879441e-001 7.78800783e-001 9.39413063e-001 9.77751237e-001

9.97503122e-001 9.99975000e-001 0.00000000e+000 0.00000000e+000

0.00000000e+000 0.00000000e+000]