Ver código fonte

Add odds ratio helpers

betbetter 1 hora atrás
pai
commit
2ea1c9bd76
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      ratio.py

+ 6 - 0
ratio.py

@@ -0,0 +1,6 @@
+def odds_ratio(p1, p2):
+    """Odds ratio between two chances."""
+    return (p1 / (1 - p1)) / (p2 / (1 - p2))
+
+def margin(prices):
+    return sum(1.0 / p for p in prices) - 1.0