{ "cells": [ { "cell_type": "markdown", "id": "33b0ae62", "metadata": {}, "source": [ "# TI 2026 in 5 charts — starter notebook\n", "\n", "538 pro Dota 2 games (every game of **TI 2026**, TI 2025, EWC 2025/2026), every 24-step\n", "Captains-Mode draft, plus a column nobody else publishes: **pre-series win\n", "probabilities archived before each TI 2026 series was played**.\n", "\n", "Dataset curated by [batru.gg](https://batru.gg) · data via the OpenDota API · CC BY 4.0." ] }, { "cell_type": "code", "execution_count": null, "id": "ff8734c9", "metadata": {}, "outputs": [], "source": [ "import glob, os\n", "import pandas as pd\n", "\n", "# Works on Kaggle (any dataset slug), Hugging Face checkouts, or a local copy.\n", "hits = glob.glob(\"/kaggle/input/*/games.parquet\")\n", "BASE = os.path.dirname(hits[0]) if hits else \".\"\n", "\n", "games = pd.read_parquet(f\"{BASE}/games.parquet\")\n", "steps = pd.read_parquet(f\"{BASE}/draft_steps.parquet\")\n", "heroes = pd.read_csv(f\"{BASE}/hero_stats.csv\")\n", "games.groupby(\"tournament\").size()" ] }, { "cell_type": "markdown", "id": "3299f0b5", "metadata": {}, "source": [ "## 1. The 100% club — Treant Protector was picked or banned in ALL 148 TI 2026 games" ] }, { "cell_type": "code", "execution_count": null, "id": "1ad2c53e", "metadata": {}, "outputs": [], "source": [ "ti = heroes[heroes.tournament == \"ti-2026\"].copy()\n", "n_games = games[games.tournament == \"ti-2026\"].match_id.nunique()\n", "top = ti.sort_values(\"contest_rate\", ascending=False).head(12)\n", "ax = top.set_index(\"hero\").contest_rate.mul(100).plot.barh(figsize=(8, 5), title=f\"Most contested heroes, TI 2026 ({n_games} games)\")\n", "ax.invert_yaxis(); ax.set_xlabel(\"% of games picked or banned\");" ] }, { "cell_type": "markdown", "id": "008c90e0", "metadata": {}, "source": [ "## 2. The popularity trap — most-picked ≠ best\n", "\n", "Hoodwink was the joint-most-picked hero of TI 2026 (73 games, tied with Mirana)\n", "and won only 41% of them. Meanwhile Earth Spirit was contested in 92.6% of\n", "drafts **and** delivered a ~66% win rate." ] }, { "cell_type": "code", "execution_count": null, "id": "86ed9e35", "metadata": {}, "outputs": [], "source": [ "t = ti[ti.picks >= 15].copy()\n", "t[\"win_rate\"] = t.wins_when_picked / t.picks\n", "t.sort_values(\"win_rate\", ascending=False)[[\"hero\", \"picks\", \"bans\", \"win_rate\"]].round(3)" ] }, { "cell_type": "code", "execution_count": null, "id": "2231d046", "metadata": {}, "outputs": [], "source": [ "ax = t.plot.scatter(x=\"picks\", y=\"win_rate\", figsize=(8, 5), title=\"TI 2026: picks vs win rate (15+ picks)\")\n", "ax.axhline(0.5, ls=\"--\", lw=1)\n", "for _, r in t.iterrows():\n", " ax.annotate(r.hero, (r.picks, r.win_rate), fontsize=7, xytext=(3, 3), textcoords=\"offset points\")" ] }, { "cell_type": "markdown", "id": "28314cf2", "metadata": {}, "source": [ "## 3. First pick and side — smaller edges than folklore says" ] }, { "cell_type": "code", "execution_count": null, "id": "7455f895", "metadata": {}, "outputs": [], "source": [ "g = games.assign(\n", " fp_won=lambda d: (d.first_pick_side == \"radiant\") == d.radiant_win,\n", ")\n", "pd.DataFrame({\n", " \"first_pick_wr\": g.groupby(\"tournament\").fp_won.mean(),\n", " \"radiant_wr\": g.groupby(\"tournament\").radiant_win.mean(),\n", " \"games\": g.groupby(\"tournament\").size(),\n", "}).round(3)" ] }, { "cell_type": "markdown", "id": "c4bae9b9", "metadata": {}, "source": [ "## 4. Draft order — where in the draft does each hero go?\n", "\n", "`step` runs 1–24 in standard Captains-Mode order. Low mean step = ban-phase-1\n", "priority target; high mean step = late-pick flex / counter-pick material." ] }, { "cell_type": "code", "execution_count": null, "id": "7277dab7", "metadata": {}, "outputs": [], "source": [ "ti_steps = steps[steps.tournament == \"ti-2026\"]\n", "order = ti_steps.groupby(\"hero\").agg(times=(\"step\", \"size\"), mean_step=(\"step\", \"mean\")).query(\"times >= 20\")\n", "order.sort_values(\"mean_step\").round(1).head(15)" ] }, { "cell_type": "markdown", "id": "1e1eb0d0", "metadata": {}, "source": [ "## 5. The honesty column — scoring the archived model predictions\n", "\n", "86 TI 2026 games carry a win probability **archived before the series started**\n", "(`model_pre_series_p_team1`). Because they were recorded pre-game, you can score\n", "them fairly — no hindsight. Brier score: 0.25 = always saying 50/50; lower is better.\n", "\n", "TI 2026 was an upset-heavy event (the champion came through the entire lower\n", "bracket), which is exactly why archived-not-backfilled predictions matter: the\n", "2025/EWC rows carry `null` instead of fabricated retro-predictions. The model's\n", "full public track record lives at [batru.gg/dota2/benchmark](https://batru.gg/dota2/benchmark).\n", "\n", "**Ideas to build on this dataset:** predict the winner from the draft alone\n", "(24 hero slots -> outcome); model hero priority as a sequence problem; detect\n", "meta shifts between tournaments/patches; find over/under-drafted heroes." ] }, { "cell_type": "code", "execution_count": null, "id": "9903bad2", "metadata": {}, "outputs": [], "source": [ "m = games.dropna(subset=[\"model_pre_series_p_team1\"]).copy()\n", "m[\"team1_won\"] = (m.winner_team == m.series_team1).astype(float)\n", "brier = ((m.model_pre_series_p_team1 - m.team1_won) ** 2).mean()\n", "acc = ((m.model_pre_series_p_team1 > 0.5) == (m.team1_won == 1)).mean()\n", "print(f\"n={len(m)} brier={brier:.4f} (0.25 = coin-flip baseline) per-game acc={acc:.1%}\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11" } }, "nbformat": 4, "nbformat_minor": 5 }