We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a99e429 commit beb489dCopy full SHA for beb489d
pymc3/math.py
@@ -31,6 +31,11 @@ def logsumexp(x, axis=None):
31
x_max = tt.max(x, axis=axis, keepdims=True)
32
return tt.log(tt.sum(tt.exp(x - x_max), axis=axis, keepdims=True)) + x_max
33
34
+def logaddexp(a, b):
35
+ diff = b - a
36
+ return tt.switch(diff > 0,
37
+ b + tt.log1p(tt.exp(-diff)),
38
+ a + tt.log1p(tt.exp(diff)))
39
40
def invlogit(x, eps=sys.float_info.epsilon):
41
return (1. - 2. * eps) / (1. + tt.exp(-x)) + eps
0 commit comments