Open xieyj17 opened 6 months ago
When I am rebasing, I accidently added the recent PR by @zaxtax .
You should add an entry in the docs API: https://github.com/pymc-devs/pymc-experimental/blob/main/docs/api_reference.rst
@ricardoV94 Thanks for you comments! I have addressed your suggested changes. Thank you!
I think the logp for Generalized Pareto distribution should be def logp(value, mu, sigma, xi): """ Calculate log-probability of Generalized Pareto distribution at specified value.
Parameters
----------
value: numeric
Value(s) for which log-probability is calculated. If the log probabilities for multiple
values are desired the values must be provided in a numpy array or Pytensor tensor
Returns
-------
TensorVariable
"""
scaled = (value - mu) / sigma
logp_expression = pt.switch(
pt.isclose(xi, 0),
-1 * scaled,
-1 * pt.log(sigma) - ((xi + 1) / xi) * pt.log1p(xi * scaled),
)
logp = pt.switch(pt.gt(1 + xi * scaled, 0), logp_expression, -np.inf)
return check_parameters(logp, sigma > 0, pt.and_(xi > -1, xi < 1), msg="sigma > 0 or -1 < xi < 1")
Generalized Pareto distribution is a commonly used distribution for modelling the tail of another distribution. It has wide applications in risk management, finance, ans quality assuarance. See wiki page.
I added a new distribution to the pymc-experimental branch.