Skip to content

Commit 3a09ee2

Browse files
ericmjlJunpeng Lao
authored and
Junpeng Lao
committed
Weibull mode (#2804)
* Add mode to Weibull * Line breaks, removed "self.parameter" from expressions.
1 parent 9cedd77 commit 3a09ee2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pymc3/distributions/continuous.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,9 @@ def __init__(self, alpha, beta, *args, **kwargs):
15541554
self.median = beta * tt.exp(gammaln(tt.log(2)))**(1. / alpha)
15551555
self.variance = (beta**2) * \
15561556
tt.exp(gammaln(1 + 2. / alpha - self.mean**2))
1557+
self.mode = tt.switch(alpha >= 1,
1558+
beta * ((alpha - 1)/alpha) ** (1 / alpha),
1559+
0) # Reference: https://en.wikipedia.org/wiki/Weibull_distribution
15571560

15581561
assert_negative_support(alpha, 'alpha', 'Weibull')
15591562
assert_negative_support(beta, 'beta', 'Weibull')

0 commit comments

Comments
 (0)