Kaynağa Gözat

Add odds ratio helpers

betbetter 1 saat önce
ebeveyn
işleme
2ea1c9bd76
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  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