Перейти к основному содержанию

Atlético de Madrid vs FC Barcelona - 12 февраля 2026

call name="codeexecution">

python

import scipy.stats as stats

import numpy as np

Weighted averages

recentatmscored = (0 + 3 + 1 + 1 + 3) / 5 # 8/5 wait, wait from data: 0,3,1,1,3? Wait, scores: 0-0 draw, 3-0 win, 1-0 win, 1-1 draw, 3-0 win. Scored: 0,3,1,1,3 =8/5=1.6

Wait, earlier I said 11, mistake.

Correct recentatmscored = (0+3+1+1+3)/5 = 8/5 = 1.6

recentatmconceded = (0+0+0+1+0)/5 = 0.2

seasonatmscored = 1.73

seasonatmconceded = 0.77

h2hatmscored = (1+0+2+4+2)/5 = 9/5 = 1.8

h2hatmconceded = (3+1+4+4+1)/5 = 13/5 = 2.6

recentbarscored = (3+3+1+2+2)/5 = 11/5 = 2.2

recentbarconceded = (1+0+2+0+0)/5 = 3/5 = 0.6

seasonbarscored = 2.73

seasonbarconceded = 1.05

h2hbarscored = (3+1+4+4+1)/5 = 13/5 = 2.6

h2hbarconceded = (1+0+2+4+2)/5 = 9/5 = 1.8

weightedatmscored = 0.5 recentatmscored + 0.3 seasonatmscored + 0.2 * h2hatmscored

weightedatmconceded = 0.5 recentatmconceded + 0.3 seasonatmconceded + 0.2 * h2hatmconceded

weightedbarscored = 0.5 recentbarscored + 0.3 seasonbarscored + 0.2 * h2hbarscored

weightedbarconceded = 0.5 recentbarconceded + 0.3 seasonbarconceded + 0.2 * h2hbarconceded

print('Weighted ATM scored:', weightedatmscored)

print('Weighted ATM conceded:', weightedatmconceded)

print('Weighted BAR scored:', weightedbarscored)

print('Weighted BAR conceded:', weightedbarconceded)

League avg - using standard La Liga approx total 2.64, per team 1.32

league_avg = 1.32

Home/away avg scored

avghomescored = 1.47

avgawayscored = 1.17

Strengths

attackatm = weightedatmscored / leagueavg

defenseatm = weightedatmconceded / leagueavg

attackbar = weightedbarscored / leagueavg

defensebar = weightedbarconceded / leagueavg

print('Attack ATM:', attack_atm)

print('Defense ATM:', defense_atm)

print('Attack BAR:', attack_bar)

print('Defense BAR:', defense_bar)

Expected goals before correction

expatm = attackatm defensebar avghome_scored

expbar = attackbar defenseatm avgaway_scored

Correction for injury: -0.2 to ATM

expatmcorrected = exp_atm - 0.2

print('Exp ATM raw:', exp_atm)

print('Exp BAR raw:', exp_bar)

print('Exp ATM corrected:', expatmcorrected)

Now Poisson probs

max_goals = 6

probs = np.zeros((maxgoals+1, maxgoals+1))

for h in range(max_goals+1):

for a in range(max_goals+1):

probs[h,a] = stats.poisson.pmf(h, expatmcorrected) * stats.poisson.pmf(a, exp_bar)

homewinprob = np.sum(probs[h>a for h in range(maxgoals+1) for a in range(maxgoals+1) wait, better:

home_win = 0

draw = 0

away_win = 0

for h in range(max_goals+1):

for a in range(max_goals+1):

p = probs[h,a]

if h > a:

home_win += p

elif h == a:

draw += p

else:

away_win += p

total = homewin + draw + awaywin

print('Raw probs - Home:', homewin100, 'Draw:', draw100, 'Away:', awaywin*100)

Adjust draw *1.15 for cup/rivalry

draw_adj = draw * 1.15

totaladj = homewin + drawadj + awaywin

homeadj = homewin / total_adj

drawadjnorm = drawadj / totaladj

awayadj = awaywin / total_adj

print('Adjusted - Home:', homeadj100, 'Draw:', drawadjnorm100, 'Away:', awayadj*100)

Most likely scores

scores = []

for h in range(max_goals+1):

for a in range(max_goals+1):

p = probs[h,a]

if p > 0.05: # top

scores.append((h, a, p*100))

scores.sort(key=lambda x: x[2], reverse=True)

top_scores = scores[:3]

print('Top scores:', top_scores)

Over 2.5

over25 = np.sum([probs[h,a] for h in range(maxgoals+1) for a in range(maxgoals+1) if h+a > 2.5])

under25 = 1 - over25

print('Over 2.5:', over25*100)

totalexp = expatmcorrected + expbar

print('Total exp:', total_exp)

BTTS

patm0 = stats.poisson.pmf(0, expatm_corrected)

pbar0 = stats.poisson.pmf(0, expbar)

pboth0 = patm0 * p_bar0

bttsno = patm0 + pbar0 - pboth0

bttsyes = 1 - bttsno

print('BTTS Yes:', btts_yes*100)

print('P ATM score:', 1 - p_atm0 *100)

print('P BAR score:', 1 - p_bar0 *100)

For corners, average total corners from H2H 11.5, season ATM for+against 6.91+3.77=10.68, Bar 6.61+3.87=10.48, say exp_corners = 10.6

But skip for now, as not main

Strengths for output

strengthattackatm = attack_atm # but it's multiplier, but for output X.XX as is? Instruction Sila Ataki = weighted / league, yes

strengthdefatm = defense_atm

strengthattackbar = attack_bar

strengthdefbar = defense_bar

print('Strengths:', strengthattackatm, strengthdefatm, strengthattackbar, strengthdefbar)

League avg for output: 1.32 ? But instruction Среднее по Лиге: X.XX голов за игру - probably total 2.64

league_total = 2.64

print('League avg total:', league_total)