Skip to content

Commit ba186e3

Browse files
ricardoV94Spaak
andauthored
Simplify wald logcdf method (#4496)
* Simplify wald logcdf method * Return logcdf = 0, when x overflows * reapplying rename theano -> aesara Co-authored-by: Eelke Spaak <[email protected]>
1 parent cf5108e commit ba186e3

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

pymc3/distributions/continuous.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,27 +1136,13 @@ def logcdf(self, value):
11361136
a = normal_lcdf(0, 1, (q - 1.0) / r)
11371137
b = 2.0 / l + normal_lcdf(0, 1, -(q + 1.0) / r)
11381138

1139-
left_limit = (
1140-
aet.lt(value, 0)
1141-
| (aet.eq(value, 0) & aet.gt(mu, 0) & aet.lt(lam, np.inf))
1142-
| (aet.lt(value, mu) & aet.eq(lam, 0))
1143-
)
1144-
right_limit = (
1145-
aet.eq(value, np.inf)
1146-
| (aet.eq(lam, 0) & aet.gt(value, mu))
1147-
| (aet.gt(value, 0) & aet.eq(lam, np.inf))
1148-
)
1149-
degenerate_dist = (aet.lt(mu, np.inf) & aet.eq(mu, value) & aet.eq(lam, 0)) | (
1150-
aet.eq(value, 0) & aet.eq(lam, np.inf)
1151-
)
1152-
11531139
return bound(
11541140
aet.switch(
1155-
~(right_limit | degenerate_dist),
1156-
a + aet.log1p(aet.exp(b - a)),
1141+
aet.lt(value, np.inf),
1142+
a + log1pexp(b - a),
11571143
0,
11581144
),
1159-
~left_limit,
1145+
0 < value,
11601146
0 < mu,
11611147
0 < lam,
11621148
0 <= alpha,

0 commit comments

Comments
 (0)