You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not an issue yet, because transforms of discrete variables aren't supported, but would be after we start allowing them (e.g., in #6836 and after #6360)
importpymcaspmimportnumpyasnpp=0.7rv=-pm.Bernoulli.dist(p=p)
# A negated Bernoulli has pmf {p if x == -1; 1-p if x == 0; 0 otherwise}assertpm.logp(rv, -2).eval() ==-np.inf# Correctassertpm.logp(rv, -1).eval() ==np.log(p) # Correctassertpm.logp(rv, 0).eval() ==np.log(1-p) # Correctassertpm.logp(rv, 1).eval() ==-np.inf# Correct
The logic here works correctly for continuous variables, but for discrete variables we need the survival function (logccdf) evaluated at backward_value-1 and not backward_value. Otherwise the following checks would fail:
ricardoV94
changed the title
Error in derived CDF for monotonically decreasing transforms of discrete variables
Correct derivation for CDF of monotonically decreasing transforms of discrete variables
Nov 2, 2023
This is not an issue yet, because transforms of discrete variables aren't supported, but would be after we start allowing them (e.g., in #6836 and after #6360)
The logic here works correctly for continuous variables, but for discrete variables we need the survival function (logccdf) evaluated at
backward_value-1
and notbackward_value
. Otherwise the following checks would fail:pymc/pymc/logprob/transforms.py
Lines 466 to 499 in f5c5c9c
Some care must also be taken for the negative odd powers
Likewise, the logic may be wrong for icdf, but I haven't checked:
pymc/pymc/logprob/transforms.py
Lines 510 to 522 in f5c5c9c
The text was updated successfully, but these errors were encountered: