Apr-04-2019, 10:55 AM
If we consider source code of distributions.py, we can find that
few methods were defined to describe probability distribution. E.g. if we define only
I just replaced
So, is it possible to find analytical forms of cdf or better inverse cdf for Jaya distribution? This is the question to be investigated.
rv_continous
class uses numerical differentiation/integration if only few methods were defined to describe probability distribution. E.g. if we define only
_pdf
method, all other methods, such as .cdf
, becomes defined due to machinery in rv_continous
(but this machinery is numerical); So, it is better to define (override) other methods, such as ._cdf
, ._icdf
explicitly; If these methods are defined explicitly, no numerical differentiaion/integration or other complex stuff be applied; Therefore, it is better to define as many helpers ._pdf
, _cdf
etc. as possible. This will increase speed and reliability of further computations. In our case, we define ._pdf
only... What is .rvs
? .rvs
is based on uniform distribution on [0,1) and inverse cdf; if you didn't define inverse cdf explicitly for your distribution, rv_continous
class tries to do all work numerically (numerical approach is less robust than computing analytical formula of icdf). This is why some warnings or even errors can occur. I just replaced
return y
with return y if x>0 else 0.0
and tried to call .rvs
(parameters were shape_=3, scale_=1): everything went fine. So, what to do?! You need to generate random numbers from Jaya distribution, ok. You can drop using rv_continous
at all. Look at implementation of _rvs
method and, if you know inverse cdf of the distribution, just generate uniformly distributed values in [0,1) and apply inverse cdf to them and you get values that have specific distribution.So, is it possible to find analytical forms of cdf or better inverse cdf for Jaya distribution? This is the question to be investigated.