Untitled

 avatar
unknown
plain_text
2 years ago
450 B
6
Indexable
import math defpoisson(actual, expected):return math.exp(-expected) * (expected**actual) / math.factorial(actual) # Example usagehome_team_avg_goals = 1.5away_team_avg_goals = 1.2 fori in range(5):  # calculate probability for first 5 score outcomes home_goals = i for j in range(5): away_goals = j p = poisson(home_goals, home_team_avg_goals) * poisson(away_goals, away_team_avg_goals)print(f"Probability of score {home_goals}-{away_goals}: {p:.4f}"
Editor is loading...