|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "021b3a4c", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# 2026 TDL Challenge: GraphUniverse\n", |
| 9 | + "\n", |
| 10 | + "This notebook evaluates your model across a grid of GraphUniverse's synthetic graph distributions:\n", |
| 11 | + "- **Homophily** (low, mid, high)\n", |
| 12 | + "- **Average degree** (low, high) \n", |
| 13 | + "- **Power-law exponent** (low, high)\n", |
| 14 | + "\n", |
| 15 | + "Each configuration is trained with multiple random seeds. The best checkpoint from each run is then evaluated on all other grid settings (out-of-distribution evaluation).\n", |
| 16 | + "\n", |
| 17 | + "## Setup Requirements\n", |
| 18 | + "\n", |
| 19 | + "**Make sure Weights & Biases is configured:**\n", |
| 20 | + "```bash\n", |
| 21 | + "wandb login\n", |
| 22 | + "```\n", |
| 23 | + "\n", |
| 24 | + "## How to Use\n", |
| 25 | + "\n", |
| 26 | + "1. Set your `MODEL_CONFIG` (path to your model yaml)\n", |
| 27 | + "2. Run the evaluation\n", |
| 28 | + "3. Results will be saved in:\n", |
| 29 | + " - `results.json` with detailed metrics\n", |
| 30 | + " - Heatmap visualizations showing performance across the grid\n", |
| 31 | + " - OOD performance delta plots" |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "cell_type": "code", |
| 36 | + "execution_count": null, |
| 37 | + "id": "53c1d2fb", |
| 38 | + "metadata": {}, |
| 39 | + "outputs": [], |
| 40 | + "source": [ |
| 41 | + "import sys\n", |
| 42 | + "from pathlib import Path\n", |
| 43 | + "\n", |
| 44 | + "# Setup paths\n", |
| 45 | + "_ROOT = Path.cwd().resolve()\n", |
| 46 | + "_REPO = _ROOT if (_ROOT / \"configs\" / \"run.yaml\").exists() else _ROOT.parent\n", |
| 47 | + "if str(_REPO) not in sys.path:\n", |
| 48 | + " sys.path.insert(0, str(_REPO))\n", |
| 49 | + "\n", |
| 50 | + "from utils import (\n", |
| 51 | + " resolve_project_root,\n", |
| 52 | + " run_challenge_grid,\n", |
| 53 | + " save_challenge_artifacts,\n", |
| 54 | + ")\n", |
| 55 | + "\n", |
| 56 | + "PROJECT_ROOT = resolve_project_root(_REPO)" |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "cell_type": "markdown", |
| 61 | + "id": "config_section", |
| 62 | + "metadata": {}, |
| 63 | + "source": [ |
| 64 | + "## Configuration\n", |
| 65 | + "\n", |
| 66 | + "**Set your model config path here:**" |
| 67 | + ] |
| 68 | + }, |
| 69 | + { |
| 70 | + "cell_type": "code", |
| 71 | + "execution_count": null, |
| 72 | + "id": "config_cell", |
| 73 | + "metadata": {}, |
| 74 | + "outputs": [], |
| 75 | + "source": [ |
| 76 | + "# Your model configuration (e.g., \"graph/gcn\", \"graph/gin\", \"graph/gat\")\n", |
| 77 | + "MODEL_CONFIG = \"graph/gin\"" |
| 78 | + ] |
| 79 | + }, |
| 80 | + { |
| 81 | + "cell_type": "markdown", |
| 82 | + "id": "run_section", |
| 83 | + "metadata": {}, |
| 84 | + "source": [ |
| 85 | + "## Run Evaluation\n", |
| 86 | + "\n", |
| 87 | + "This will train and evaluate your model across all grid configurations." |
| 88 | + ] |
| 89 | + }, |
| 90 | + { |
| 91 | + "cell_type": "code", |
| 92 | + "execution_count": null, |
| 93 | + "id": "93a4bb1f", |
| 94 | + "metadata": {}, |
| 95 | + "outputs": [], |
| 96 | + "source": [ |
| 97 | + "results, study_id = run_challenge_grid(\n", |
| 98 | + " project_root=PROJECT_ROOT,\n", |
| 99 | + " model_config=MODEL_CONFIG,\n", |
| 100 | + ")" |
| 101 | + ] |
| 102 | + }, |
| 103 | + { |
| 104 | + "cell_type": "markdown", |
| 105 | + "id": "save_section", |
| 106 | + "metadata": {}, |
| 107 | + "source": [ |
| 108 | + "## Save Results\n", |
| 109 | + "\n", |
| 110 | + "Generate JSON output and visualization plots." |
| 111 | + ] |
| 112 | + }, |
| 113 | + { |
| 114 | + "cell_type": "code", |
| 115 | + "execution_count": null, |
| 116 | + "id": "save_cell", |
| 117 | + "metadata": {}, |
| 118 | + "outputs": [], |
| 119 | + "source": [ |
| 120 | + "output_paths = save_challenge_artifacts(\n", |
| 121 | + " results,\n", |
| 122 | + " model_config=MODEL_CONFIG,\n", |
| 123 | + " study_id=study_id,\n", |
| 124 | + ")\n", |
| 125 | + "\n", |
| 126 | + "print(f\"\\nResults saved to: {output_paths['dir']}\")\n", |
| 127 | + "print(f\"JSON: {output_paths['json']}\")" |
| 128 | + ] |
| 129 | + }, |
| 130 | + { |
| 131 | + "cell_type": "markdown", |
| 132 | + "id": "inspect_section", |
| 133 | + "metadata": {}, |
| 134 | + "source": [ |
| 135 | + "## Inspect Results\n", |
| 136 | + "\n", |
| 137 | + "View results as a DataFrame for quick inspection." |
| 138 | + ] |
| 139 | + }, |
| 140 | + { |
| 141 | + "cell_type": "code", |
| 142 | + "execution_count": null, |
| 143 | + "id": "inspect_cell", |
| 144 | + "metadata": {}, |
| 145 | + "outputs": [], |
| 146 | + "source": [ |
| 147 | + "import pandas as pd\n", |
| 148 | + "\n", |
| 149 | + "pd.DataFrame(results)" |
| 150 | + ] |
| 151 | + } |
| 152 | + ], |
| 153 | + "metadata": { |
| 154 | + "kernelspec": { |
| 155 | + "display_name": "tb", |
| 156 | + "language": "python", |
| 157 | + "name": "python3" |
| 158 | + }, |
| 159 | + "language_info": { |
| 160 | + "codemirror_mode": { |
| 161 | + "name": "ipython", |
| 162 | + "version": 3 |
| 163 | + }, |
| 164 | + "file_extension": ".py", |
| 165 | + "mimetype": "text/x-python", |
| 166 | + "name": "python", |
| 167 | + "nbconvert_exporter": "python", |
| 168 | + "pygments_lexer": "ipython3", |
| 169 | + "version": "3.11.3" |
| 170 | + } |
| 171 | + }, |
| 172 | + "nbformat": 4, |
| 173 | + "nbformat_minor": 5 |
| 174 | +} |
0 commit comments