aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2023-01-27 18:08:42 +1100
committerJustin Bedo <cu@cua0.org>2023-03-05 11:09:26 +1100
commit906ae5ad3a960e4c7d7c32528ced79ba63ee2238 (patch)
treebf8ec01d06fa7d83dcc3517d2eb4a467f446bf8d
parent368ebf9f96e4fded6b69ca609f9db53eb19b4589 (diff)
add beta' distributionHEADmaster
-rw-r--r--src/PPL/Distr.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/PPL/Distr.hs b/src/PPL/Distr.hs
index 797379b..093e102 100644
--- a/src/PPL/Distr.hs
+++ b/src/PPL/Distr.hs
@@ -69,6 +69,10 @@ beta a b = do
y <- gamma b
pure $ x / (x + y)
+beta' a b = do
+ p <- beta a b
+ pure $ p / (1-p)
+
bern p = (< p) <$> uniform
binom n = fmap (length . filter id . take n) . iid . bern