Skip to content

Commit 9b6c019

Browse files
committed
Implement Constant logcdf
1 parent 48dab2c commit 9b6c019

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pymc/distributions/discrete.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,13 @@ def logp(value, c):
13781378
-np.inf,
13791379
)
13801380

1381+
def logcdf(value, c):
1382+
return at.switch(
1383+
at.lt(value, c),
1384+
-np.inf,
1385+
0,
1386+
)
1387+
13811388

13821389
class ZeroInflatedPoissonRV(RandomVariable):
13831390
name = "zero_inflated_poisson"

pymc/tests/test_distributions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,7 @@ def test_poisson(self):
17441744

17451745
def test_constantdist(self):
17461746
self.check_logp(Constant, I, {"c": I}, lambda value, c: np.log(c == value))
1747+
self.check_logcdf(Constant, I, {"c": I}, lambda value, c: np.log(value >= c))
17471748

17481749
def test_zeroinflatedpoisson(self):
17491750
def logp_fn(value, psi, theta):

0 commit comments

Comments
 (0)