<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: xgmind</title>
    <description>The latest articles on DEV Community by xgmind (@dadizhu_9952a1d1b22e3afda).</description>
    <link>https://dev.to/dadizhu_9952a1d1b22e3afda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4268886%2F57798919-9a18-43e7-8666-b7c0c107d7ea.png</url>
      <title>DEV Community: xgmind</title>
      <link>https://dev.to/dadizhu_9952a1d1b22e3afda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dadizhu_9952a1d1b22e3afda"/>
    <language>en</language>
    <item>
      <title>Why Rolling Form Windows Fail Across League and Cup Schedules</title>
      <dc:creator>xgmind</dc:creator>
      <pubDate>Fri, 27 Nov 2026 23:30:08 +0000</pubDate>
      <link>https://dev.to/dadizhu_9952a1d1b22e3afda/why-rolling-form-windows-fail-across-league-and-cup-schedules-5cag</link>
      <guid>https://dev.to/dadizhu_9952a1d1b22e3afda/why-rolling-form-windows-fail-across-league-and-cup-schedules-5cag</guid>
      <description>&lt;p&gt;Every pre-match table includes some version of "last five matches." It is the most familiar shorthand in football coverage: five coloured letters, a goals column and perhaps a rolling expected-goals average.&lt;/p&gt;

&lt;p&gt;Yet two analysts can pull the "last five" for the same club on the same morning and get different numbers. One query filters strictly for domestic league fixtures. The other pulls the last five competitive games across all tournaments—bundling three league games, a midweek Champions League trip and a domestic cup tie against a third-division opponent where nine starters rested.&lt;/p&gt;

&lt;p&gt;Neither query is a software crash, and both produce clean decimals. The problem is that an unlabelled rolling window hides &lt;em&gt;which&lt;/em&gt; environment generated the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  One team, three different "last five" averages
&lt;/h2&gt;

&lt;p&gt;To see how quickly schedule mixing changes a baseline, consider a &lt;strong&gt;constructed five-match sequence&lt;/strong&gt; for a top-flight club playing across three competitions in a single month:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Match&lt;/th&gt;
&lt;th&gt;Competition&lt;/th&gt;
&lt;th&gt;Opponent level &amp;amp; lineup note&lt;/th&gt;
&lt;th&gt;Goals for–against&lt;/th&gt;
&lt;th&gt;xG for–against&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Domestic League&lt;/td&gt;
&lt;td&gt;Mid-table league rival (full starters)&lt;/td&gt;
&lt;td&gt;2–1&lt;/td&gt;
&lt;td&gt;1.65 – 1.05&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;UEFA Cup Phase&lt;/td&gt;
&lt;td&gt;Elite European away fixture (low block)&lt;/td&gt;
&lt;td&gt;0–2&lt;/td&gt;
&lt;td&gt;0.55 – 2.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Domestic League&lt;/td&gt;
&lt;td&gt;Top-six rival (full starters)&lt;/td&gt;
&lt;td&gt;1–1&lt;/td&gt;
&lt;td&gt;1.35 – 1.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Domestic Cup R3&lt;/td&gt;
&lt;td&gt;Third-tier opponent (8 starters rested)&lt;/td&gt;
&lt;td&gt;5–0&lt;/td&gt;
&lt;td&gt;3.80 – 0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Domestic League&lt;/td&gt;
&lt;td&gt;Lower-half league opponent (full starters)&lt;/td&gt;
&lt;td&gt;2–0&lt;/td&gt;
&lt;td&gt;1.80 – 0.80&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These figures are &lt;strong&gt;hypothetical&lt;/strong&gt; and designed to isolate the aggregation effect. Look at what happens when downstream code summarizes this club's attacking output:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;All-competitions 5-match mean:&lt;/strong&gt; &lt;code&gt;(1.65 + 0.55 + 1.35 + 3.80 + 1.80) / 5 = 1.83 xG For&lt;/code&gt; and &lt;code&gt;1.08 xGA&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domestic league-only 3-match mean:&lt;/strong&gt; &lt;code&gt;(1.65 + 1.35 + 1.80) / 3 = 1.60 xG For&lt;/code&gt; and &lt;code&gt;1.03 xGA&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-competition cup lookup before Round 4:&lt;/strong&gt; &lt;code&gt;3.80 xG For&lt;/code&gt; and &lt;code&gt;0.20 xGA&lt;/code&gt; (a sample of &lt;code&gt;N = 1&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The all-competitions average is pulled upward by the &lt;code&gt;3.80 xG&lt;/code&gt; cup rout against a lower-division side, while simultaneously absorbing the &lt;code&gt;0.55 xG&lt;/code&gt; defensive shell from a tough European away night. If the upcoming fixture is an ordinary domestic league game, the unadjusted five-match blend describes a team that neither existed in the cup tie (rotated squad) nor faces a Champions League away environment this weekend.&lt;/p&gt;

&lt;h2&gt;
  
  
  The single-match cup denominator trap
&lt;/h2&gt;

&lt;p&gt;An even sharper distortion occurs when an automated pipeline switches from "all competitions" to "current competition only" without checking the denominator.&lt;/p&gt;

&lt;p&gt;Suppose a club enters the second round of a domestic cup. A naive database query asks for the club's season-to-date goals per match and xG per match in &lt;code&gt;competition_id = domestic_cup&lt;/code&gt;. Because the team has played only one cup tie so far—say, the &lt;code&gt;5–0&lt;/code&gt; win in the table above—the query returns a "season average" of &lt;code&gt;5.00 goals per match&lt;/code&gt; and &lt;code&gt;3.80 xG per match&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If that number is fed directly into a Poisson goal model or an language-model prompt without its sample size (&lt;code&gt;N = 1&lt;/code&gt;), the model treats a single ninety-minute cup tie as if it were a twenty-match league baseline.&lt;/p&gt;

&lt;p&gt;As we noted in our guide on &lt;a href="https://xgmind.com/blog/missing-football-data-is-not-zero/" rel="noopener noreferrer"&gt;why missing football data is not zero&lt;/a&gt;, a rate without its denominator is an incomplete measurement. In cup competitions and early league rounds, a sound pipeline should:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Attach the exact match count (&lt;code&gt;N&lt;/code&gt;) to every season or rolling rate.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce a minimum sample threshold&lt;/strong&gt; (for example, requiring at least 3 to 5 completed matches in the target competition before treating competition-only rates as standalone baselines).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document the fallback&lt;/strong&gt; when the competition sample is too small—such as falling back to the club's primary domestic league baseline while flagging the cross-competition substitution.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When all-competitions windows &lt;em&gt;are&lt;/em&gt; the right choice
&lt;/h2&gt;

&lt;p&gt;Separating league and cup baselines for goal-rate estimation does not mean cup fixtures should be deleted from the pre-match record. For two specific questions, an all-competitions timeline is essential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rest days and physical load:&lt;/strong&gt; A Thursday night knockout tie that went to extra time affects Sunday's league match regardless of competition labels. Filtering out non-league games makes a congested seven-day, three-match stretch look like a full week of rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lineup continuity and injury context:&lt;/strong&gt; If a key defensive midfielder picked up a suspension or hamstring injury in a midweek cup game, a league-only match log will not explain why the player disappeared from the weekend starting eleven.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The practical rule is to &lt;strong&gt;match the filter to the mechanism&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Analytical question&lt;/th&gt;
&lt;th&gt;Appropriate fixture scope&lt;/th&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Baseline attacking and defensive strength&lt;/td&gt;
&lt;td&gt;Same competition (or primary domestic league with opponent-strength adjustment)&lt;/td&gt;
&lt;td&gt;Sample size (&lt;code&gt;N&lt;/code&gt;), home/away split, and whether promoted or newly rebuilt squads are involved.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rest, travel and congestion&lt;/td&gt;
&lt;td&gt;All competitive fixtures&lt;/td&gt;
&lt;td&gt;Hours since last kickoff, travel distance, and how many projected starters actually played midweek minutes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tactical matchup and recent momentum&lt;/td&gt;
&lt;td&gt;Recent competitive matches with lineup context&lt;/td&gt;
&lt;td&gt;Whether the coach used the first-choice system or a heavily rotated cup eleven.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Home and away balance inside a short window
&lt;/h2&gt;

&lt;p&gt;Short rolling windows have a second hidden bias: schedule asymmetry.&lt;/p&gt;

&lt;p&gt;In a five-match league window, a club must play either &lt;code&gt;3 Home / 2 Away&lt;/code&gt; or &lt;code&gt;2 Home / 3 Away&lt;/code&gt;—and after postponements, occasionally &lt;code&gt;4 Home / 1 Away&lt;/code&gt;. If home advantage in a given league is worth roughly &lt;code&gt;0.30&lt;/code&gt; to &lt;code&gt;0.40&lt;/code&gt; expected goals per match, a five-game window with four home fixtures will naturally look stronger than a five-game window with four away trips, even if the team's underlying level has not changed at all.&lt;/p&gt;

&lt;p&gt;Here is a tiny Python check you can run on any fixture list before feeding a rolling average into a model or summary table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;summarize_rolling_window&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fixtures&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_competition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""
    Inspect schedule mix inside a rolling fixture window.
    Each item in fixtures is a dict with:
      comp, is_home, xg_for, xg_against, starter_minutes_share
    """&lt;/span&gt;
    &lt;span class="n"&gt;n_total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fixtures&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;same_comp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fixtures&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;target_competition&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;home_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fixtures&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;rotated_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fixtures&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;0.60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"window_size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;n_total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"same_competition_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;same_comp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"home_away_split"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{home_count}H-{n_total - home_count}A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"heavily_rotated_matches"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotated_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"all_comp_xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fixtures&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n_total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n_total&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"same_comp_xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;same_comp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;same_comp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;same_comp&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="n"&gt;sample_window&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"League"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.65&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_against"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Europe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_against"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.91&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"League"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.35&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_against"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.93&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Cup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;    &lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_against"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.32&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"comp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"League"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"is_home"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="s2"&gt;"xg_for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"xg_against"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"starter_minutes_share"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.96&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;summarize_rolling_window&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sample_window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_competition&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"League"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# {'window_size': 5, 'same_competition_count': 3, 'home_away_split': '3H-2A',&lt;/span&gt;
&lt;span class="c1"&gt;#  'heavily_rotated_matches': 1, 'all_comp_xg_for': 1.83, 'same_comp_xg_for': 1.6}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exposing those four metadata fields—&lt;code&gt;same_competition_count&lt;/code&gt;, &lt;code&gt;home_away_split&lt;/code&gt;, &lt;code&gt;heavily_rotated_matches&lt;/code&gt;, and the split between all-competition and same-competition means—prevents almost every misreading of a short form table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist for reading any "last five" claim
&lt;/h2&gt;

&lt;p&gt;Before trusting a rolling form comparison in a match preview—whether on &lt;a href="https://xgmind.com/teams/" rel="noopener noreferrer"&gt;XG Mind's team pages&lt;/a&gt;, our &lt;a href="https://dev.to/"&gt;daily match intelligence briefings&lt;/a&gt;, or an external analysis—check four things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Competition boundary:&lt;/strong&gt; Are these five matches from the same league, or do they mix domestic cups, continental phases and friendlies?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sample denominator (&lt;code&gt;N&lt;/code&gt;):&lt;/strong&gt; If a cup or early-season average is quoted, how many completed matches are inside that average?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Venue split:&lt;/strong&gt; How many of the window's fixtures were played at home versus away, and how are season-long home/away rates behaving by comparison?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lineup overlap:&lt;/strong&gt; Did the players who generated that five-match form actually play in those matches, or was a cup tie contested by a second-string eleven?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rolling windows are useful because full-season averages react slowly to coaching changes, injuries and tactical shifts. They only work when the matches inside the window are comparable to the match you are trying to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further reading:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://statsbomb.com/soccer-metrics/expected-goals-xg-explained/" rel="noopener noreferrer"&gt;Hudl StatsBomb: Expected Goals (xG) Explained&lt;/a&gt;, on what shot-based xG measures and why single-match totals fluctuate around underlying team strength.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://fivethirtyeight.com/methodology/how-our-club-soccer-predictions-work/" rel="noopener noreferrer"&gt;FiveThirtyEight Club Soccer Predictions Methodology&lt;/a&gt;, on how cross-competition ratings adjust for opponent strength and competition tier rather than averaging raw match logs.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://xgmind.com/blog/football-backtesting-data-leakage/" rel="noopener noreferrer"&gt;The Backtest That Knew Tomorrow: Football Data Leakage&lt;/a&gt;, on ensuring rolling windows strictly respect kickoff cutoffs.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at *&lt;/em&gt;&lt;a href="https://xgmind.com/blog/rolling-form-windows-league-and-cup-schedules/" rel="noopener noreferrer"&gt;XG Mind Research Blog&lt;/a&gt;*&lt;em&gt;. Explore live match intelligence and our &lt;a href="https://xgmind.com/performance/" rel="noopener noreferrer"&gt;verified public performance ledger&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>tacticalanalysis</category>
      <category>expectedgoals</category>
    </item>
    <item>
      <title>Missing Football Data Is Not Zero</title>
      <dc:creator>xgmind</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:56:18 +0000</pubDate>
      <link>https://dev.to/dadizhu_9952a1d1b22e3afda/missing-football-data-is-not-zero-101g</link>
      <guid>https://dev.to/dadizhu_9952a1d1b22e3afda/missing-football-data-is-not-zero-101g</guid>
      <description>&lt;p&gt;An analyst asks for a club's average xG over five matches. The database has values for three. Two fields are empty.&lt;/p&gt;

&lt;p&gt;One query replaces the empty fields with zero and divides the total by five. Another silently averages the three available values and calls it a five-match average. Both outputs look tidy. Neither accurately describes the evidence.&lt;/p&gt;

&lt;p&gt;Missing-data handling is not housekeeping at the edge of football analysis. It can change the central conclusion while leaving no obvious trace in the finished preview.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fxgmind.com%2Fstatic%2Fimages%2Fblog%2Fmissing-is-not-zero.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fxgmind.com%2Fstatic%2Fimages%2Fblog%2Fmissing-is-not-zero.webp" alt="A magnifying glass highlights an empty dashed data card beside a separate card marked zero on a football pitch." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br&gt;An unavailable measurement and an observed zero are different states. AI-generated conceptual illustration; the cards do not represent the five-match example below.
  &lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Put the denominator beside the number
&lt;/h2&gt;

&lt;p&gt;Take a &lt;strong&gt;fictional&lt;/strong&gt; sequence of xG observations: &lt;code&gt;1.4, missing, 1.8, missing, 1.0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The observed values sum to 4.2. Dividing by five gives 0.84; dividing by the three observed fixtures gives 1.40. The second is a valid mean of the observed values, but it is not automatically an estimate of the full five-match period.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Treatment&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;What the reader should be told&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Replace missing with zero&lt;/td&gt;
&lt;td&gt;0.84&lt;/td&gt;
&lt;td&gt;Two missing observations were assumed to be zero; usually inappropriate.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mean of observed fixtures&lt;/td&gt;
&lt;td&gt;1.40&lt;/td&gt;
&lt;td&gt;Only three of the five fixtures have this metric.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apply a documented fallback&lt;/td&gt;
&lt;td&gt;Depends on the rule&lt;/td&gt;
&lt;td&gt;Which values were estimated, how and from which evidence.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Omit the comparison&lt;/td&gt;
&lt;td&gt;No average reported&lt;/td&gt;
&lt;td&gt;Coverage is too limited for the intended claim.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The missing fixtures may not resemble the observed ones. A provider might cover major league games but omit cup games. Complete-case averages can therefore change the competition mix rather than merely reduce the sample size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate the different kinds of absence
&lt;/h2&gt;

&lt;p&gt;An empty field can mean that the provider does not cover the competition, that the match's statistics have not arrived, or that our collection failed. It can also mean an identity-mapping problem: a row exists, but it belongs to a different team in the source's ID system.&lt;/p&gt;

&lt;p&gt;Those situations require different responses. Retrying may resolve a delayed update. It will not create tracking metrics for a competition the source does not cover. Filling a mapping failure with an average conceals an engineering fault.&lt;/p&gt;

&lt;p&gt;Stale is another state, not a synonym for missing. Yesterday's team totals may be valid for yesterday's cutoff but not for a report that claims to include today's completed fixture.&lt;/p&gt;

&lt;p&gt;A practical record should distinguish observed, missing, estimated and stale values. Preserve a reason when it is known. Where the reason is unknown, say so instead of guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define completeness for the question being asked
&lt;/h2&gt;

&lt;p&gt;A non-empty statistics table is not necessarily a complete statistics table. It may contain shots and possession while omitting xG. A "last five" sample may contain four settled matches and a postponed fixture.&lt;/p&gt;

&lt;p&gt;Check the fields required by the actual analysis. If the claim concerns non-penalty xG, total xG alone is not enough. If a keeper comparison requires post-shot metrics, conventional xG cannot silently replace them.&lt;/p&gt;

&lt;p&gt;This distinction prevents a common software error: treating "some rows exist" as proof that the requested dataset is ready. Coverage should be a property of named measurements over a specified period.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://xgmind.com/blog/xg-the-ultimate-lie-detector-football-audit/" rel="noopener noreferrer"&gt;xG audit guide&lt;/a&gt; explains why the provider and definition belong alongside those measurements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fallbacks change the question
&lt;/h2&gt;

&lt;p&gt;Early in a season, last season's data may offer context when the current sample is small. It is a defensible choice only if it is disclosed. A promoted team, changed coach or heavily rebuilt squad can make the old sample poorly matched to the current one.&lt;/p&gt;

&lt;p&gt;A league-level baseline is another possible fallback. It describes a prior expectation for the relevant population, not a newly observed fact about the club. If the team has little evidence, the report should not present the baseline to two decimal places as though it were a precise club measurement.&lt;/p&gt;

&lt;p&gt;A blend of old and new observations also needs a rule. Record the weights, eligibility and evaluation procedure. Choosing the blend that produces the preferred narrative is not a method.&lt;/p&gt;

&lt;p&gt;Sometimes the best fallback is to leave the comparison out. There is no requirement that every report contain every advanced statistic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Show uncertainty without inventing confidence
&lt;/h2&gt;

&lt;p&gt;A useful limitation statement is specific: "xG is available for three of the five league fixtures; the two missing matches are excluded from this comparison."&lt;/p&gt;

&lt;p&gt;An unhelpful one says "data may be incomplete" after presenting a confident ranking. The reader cannot tell which part of the ranking is affected.&lt;/p&gt;

&lt;p&gt;Reduced coverage may justify more cautious interpretation, but it does not mechanically imply a particular numerical confidence reduction. Unless a procedure for that reduction has been tested, avoid inventing an adjustment such as "subtract 10% confidence."&lt;/p&gt;

&lt;p&gt;Language models need the same information. Give them the metric value, available count, requested count, period and missing reason where known. A fluent writer cannot recover observations that were never supplied.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preserve the fallback used at the time
&lt;/h2&gt;

&lt;p&gt;An upstream provider may fill the empty field a day later. Updating the current database is sensible. Reconstructing an old forecast from that improved database is a separate operation.&lt;/p&gt;

&lt;p&gt;Keep the original input snapshot or at least a versioned record of the values and fallback used. Otherwise a later audit can make yesterday's system appear to have known more than it did. Our &lt;a href="https://xgmind.com/blog/football-backtesting-data-leakage/" rel="noopener noreferrer"&gt;data-leakage article&lt;/a&gt; examines that timing problem in detail.&lt;/p&gt;

&lt;p&gt;If a missing value affected a published conclusion, make the correction visible. Fixing the input without acknowledging its effect can leave the reader with an unexplained reversal.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to display in a data-driven preview
&lt;/h2&gt;

&lt;p&gt;For an important rolling metric, show the provider, competition, period, observed fixture count and last relevant update. Mark fallback values distinctly. Distinguish "not covered" from "temporarily unavailable" where possible.&lt;/p&gt;

&lt;p&gt;These are design recommendations, not a claim that every &lt;a href="https://xgmind.com/teams/" rel="noopener noreferrer"&gt;XG Mind data page&lt;/a&gt; already displays all of them. The purpose is to give readers a standard against which any platform, including ours, can be checked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further reading:&lt;/strong&gt; &lt;a href="https://scikit-learn.org/stable/modules/impute.html" rel="noopener noreferrer"&gt;Scikit-learn: imputation of missing values&lt;/a&gt; describes general imputation approaches. Choosing one for football still requires domain assumptions and out-of-sample evaluation; a software default is not a justification.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at *&lt;/em&gt;&lt;a href="https://xgmind.com/blog/missing-football-data-is-not-zero/" rel="noopener noreferrer"&gt;XG Mind Research Blog&lt;/a&gt;*&lt;em&gt;. Explore live match intelligence and our &lt;a href="https://xgmind.com/performance/" rel="noopener noreferrer"&gt;verified public performance ledger&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dataquality</category>
      <category>dataengineering</category>
      <category>expectedgoals</category>
    </item>
    <item>
      <title>The Backtest That Knew Tomorrow: Football Data Leakage</title>
      <dc:creator>xgmind</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:56:11 +0000</pubDate>
      <link>https://dev.to/dadizhu_9952a1d1b22e3afda/the-backtest-that-knew-tomorrow-football-data-leakage-i57</link>
      <guid>https://dev.to/dadizhu_9952a1d1b22e3afda/the-backtest-that-knew-tomorrow-football-data-leakage-i57</guid>
      <description>&lt;p&gt;A historical test produces excellent results. Then the model is used before real matches and the improvement disappears.&lt;/p&gt;

&lt;p&gt;There are several possible explanations: changed conditions, too little data or a model chosen to fit the test period. One deserves checking early because it is so easy to miss: the historical test may have known things that the live forecast could not know.&lt;/p&gt;

&lt;p&gt;In football, the database makes this particularly tempting. It holds the fixture, the outcome and the finished match's statistics together. A convenient join can turn tomorrow's information into an apparently ordinary input column.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fxgmind.com%2Fstatic%2Fimages%2Fblog%2Ffuture-data-leakage.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fxgmind.com%2Fstatic%2Fimages%2Fblog%2Ffuture-data-leakage.webp" alt="An amber arrow carries a completed match report backwards across a kickoff cutoff into historical input data." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br&gt;The backward arrow represents future information entering an earlier forecast. AI-generated conceptual illustration; the forecast cutoff may precede kickoff, as in the timeline below.
  &lt;p&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The cutoff is part of the forecast
&lt;/h2&gt;

&lt;p&gt;Consider a &lt;strong&gt;hypothetical timeline&lt;/strong&gt; for a Saturday fixture:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Available information&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Friday, 18:00&lt;/td&gt;
&lt;td&gt;Preview published; earlier results and available team news can be used.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saturday, 14:00&lt;/td&gt;
&lt;td&gt;Official starting lineups become available.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saturday, 15:00&lt;/td&gt;
&lt;td&gt;Match kicks off.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saturday, 17:00&lt;/td&gt;
&lt;td&gt;Result is known; match statistics may still be incomplete.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sunday, 10:00&lt;/td&gt;
&lt;td&gt;Provider revises or fills some statistics.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A Friday-evening forecast cannot use Saturday's starting lineup merely because the lineup now appears on the fixture page. A forecast twenty minutes before kickoff can use it if it was actually available then. Neither can use the match's eventual xG as a pre-match feature.&lt;/p&gt;

&lt;p&gt;The precise times here are illustrative, not claims about any competition's announcement schedule. The rule is about availability, not one standard hour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Event time and availability time are different
&lt;/h2&gt;

&lt;p&gt;A statistic can describe a match played yesterday but only reach the system this morning. Its event time is yesterday; its availability time is this morning.&lt;/p&gt;

&lt;p&gt;A backtest filtering only on match dates may use it for a forecast supposedly produced last night. That is still leakage, even though the event happened before the forecast.&lt;/p&gt;

&lt;p&gt;For repeatable evaluation, preserve when an observation became usable and which version was used. A later provider correction should not silently overwrite the historical inputs used to judge the model.&lt;/p&gt;

&lt;p&gt;If availability history was never recorded, acknowledge the limitation. A reconstructed historical test can still be useful, but it should not be described as an exact replay of live decision-making.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rolling window can include the target
&lt;/h2&gt;

&lt;p&gt;A "last five matches" feature is a frequent culprit. Build it on a season table that already contains the target match and it may include the result you are trying to predict.&lt;/p&gt;

&lt;p&gt;For a simple sequence of completed fixtures for one team, the conceptual operation is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;feature for fixture t = aggregate of eligible observations before t&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A shifted rolling calculation can enforce that exclusion in a clean, correctly ordered sequence. It is not a complete solution for football data. Postponements, simultaneous fixtures, team identifiers, competition boundaries and late-arriving metrics all need handling.&lt;/p&gt;

&lt;p&gt;Check a handful of rows manually. For each target match, print the identifiers of the observations used to build the feature. A feature name such as &lt;code&gt;pre_match_form&lt;/code&gt; is not evidence that the implementation respected its cutoff.&lt;/p&gt;

&lt;h2&gt;
  
  
  A chronological split helps, but does not repair future features
&lt;/h2&gt;

&lt;p&gt;Training on earlier periods and evaluating on later periods better resembles live use than randomly mixing a season's fixtures. Still, splitting by time does not make a leaked column safe. A feature containing the final league position or current full-season averages may already include later results.&lt;/p&gt;

&lt;p&gt;There is also leakage from preprocessing. If scaling, imputation or feature selection is learned from the entire dataset before the split, the evaluation period influences the model-building process. Fit those steps on the training data and apply the learned transformation to held-out data.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://scikit-learn.org/stable/common_pitfalls.html#data-leakage" rel="noopener noreferrer"&gt;scikit-learn pitfalls guide&lt;/a&gt; documents this issue. Its &lt;a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html" rel="noopener noreferrer"&gt;TimeSeriesSplit reference&lt;/a&gt; is useful too, but notes an equal-spacing assumption for comparable fold durations. Football fixtures are irregularly scheduled; date-based blocks may be more appropriate than blindly using the default row-based splits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tuning can turn the test set into training data
&lt;/h2&gt;

&lt;p&gt;Suppose a researcher tests twenty rolling windows, five league filters and several confidence thresholds, then publishes the combination with the best result. No final-score column has leaked, but the supposedly held-out period has still guided method selection.&lt;/p&gt;

&lt;p&gt;Use a validation period for those decisions and reserve a later test period for the final evaluation. If the method is changed after looking at the final test, call the new result exploratory and arrange another test.&lt;/p&gt;

&lt;p&gt;A small improvement should also be compared with a fixed baseline on the same fixtures. Better &lt;a href="https://xgmind.com/blog/football-forecast-calibration-brier-score/" rel="noopener noreferrer"&gt;Brier scores or calibration plots&lt;/a&gt; cannot compensate for contaminated evaluation inputs.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical audit before trusting the headline
&lt;/h2&gt;

&lt;p&gt;Ask the researcher to show one target fixture with its original input snapshot. Trace each feature to a source observation and an availability time. Confirm that no target-match statistics or later revision entered the input.&lt;/p&gt;

&lt;p&gt;Then check the split: what was trained, what was tuned, and what remained untouched until the final evaluation? Inspect how missing values were handled; a current backfill can erase a missing-data situation that the live system really faced.&lt;/p&gt;

&lt;p&gt;Finally, look for a live or forward-recorded sample. A smaller sample recorded prospectively may offer stronger evidence about the published process than a much larger retrospective test with uncertain data provenance.&lt;/p&gt;

&lt;p&gt;XG Mind's &lt;a href="https://xgmind.com/methodology/" rel="noopener noreferrer"&gt;methodology page&lt;/a&gt; and &lt;a href="https://xgmind.com/performance/" rel="noopener noreferrer"&gt;public record&lt;/a&gt; should be examined under the same standard. This article describes an audit procedure, not a claim that an independent audit has certified every part of the platform.&lt;/p&gt;

&lt;p&gt;The shortest useful question is: &lt;strong&gt;could the system really have known this value then?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt; &lt;a href="https://scikit-learn.org/stable/common_pitfalls.html#data-leakage" rel="noopener noreferrer"&gt;Scikit-learn: common pitfalls and data leakage&lt;/a&gt;; &lt;a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html" rel="noopener noreferrer"&gt;TimeSeriesSplit documentation&lt;/a&gt;. The match timeline is a constructed example.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at *&lt;/em&gt;&lt;a href="https://xgmind.com/blog/football-backtesting-data-leakage/" rel="noopener noreferrer"&gt;XG Mind Research Blog&lt;/a&gt;*&lt;em&gt;. Explore live match intelligence and our &lt;a href="https://xgmind.com/performance/" rel="noopener noreferrer"&gt;verified public performance ledger&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>forecastevaluation</category>
      <category>dataleakage</category>
    </item>
  </channel>
</rss>
