計算勝率(odds)與機率
在這個練習中,你會複習勝率(odds)的概念,以及它與機率之間的關係。
回想影片中的公式:
$$ \text{odds} = \frac{\text{事件發生}}{\text{事件未發生}} $$
以及以機率表示的勝率:
$$ \text{odds} = \frac{\text{probability}}{1-\text{probability}} $$
本練習屬於課程
Generalized Linear Models in Python
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Compute the odds
odds = ____/(____-____)
# Print the result
print('Odds are: ', round(____,3))