Skip to content

Commit 22cc2b2

Browse files
committed
hotfix for credibility
1 parent 57bf478 commit 22cc2b2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

mvtk/credibility.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def credible_interval(positive, negative, credibility=0.5, prior=(1, 1)):
2020
returns:
2121
(lower bound, upper bound)
2222
"""
23-
distribution = beta(positive + prior[0], negative + prior[1])
23+
positive += prior[0]
24+
negative += prior[1]
25+
distribution = beta(positive, negative)
26+
if positive + negative <= 0:
27+
raise ValueError("Counts plus pseudocounts must be positive")
2428
mode = positive / (positive + negative)
2529
cdf_mode = distribution.cdf(mode)
2630
cred_2 = credibility / 2

mvtk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.1"
1+
__version__ = "0.1.2"

0 commit comments

Comments
 (0)