{
 "cells": [
  {
   "id": "cell-00",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "# Northstar: forecast demand before committing inventory\n",
    "\n",
    "**Casebook links: RET-01 / RET-09 · Real pretrained model · Synthetic data · Rolling-origin evaluation**\n",
    "\n",
    "A category planner needs the next three days of hourly order demand. Under-ordering loses service; over-ordering ties up stock. Can a pretrained model beat a same-hour-yesterday rule, and does historical retrieval help?\n",
    "\n",
    "The saved example compares persistence, daily seasonality, direct NV-Tesseract forecasting, and DARR context-enhanced forecasting on three predeclared nonoverlapping future blocks. It then compares decisions when shortages cost more than excess capacity.\n",
    "\n",
    "## Prerequisites and support\n",
    "\n",
    "**Dependency-incomplete download:** this `.ipynb` preserves the lesson and its saved outputs, but is **not a standalone runnable package**. It does not include `time_series_lab.py`, `time_series_prepare.py`, `time-series-model-lock.json`, `mementropy.mplstyle`, the pinned upstream SDK checkout, or model assets. There is no verified public support bundle or locked Python environment for this download. Installing Jupyter alone will not make Run All work.\n",
    "\n",
    "The original setup used Python 3.12 with Jupyter/IPython, NumPy, pandas, Matplotlib, PyTorch and the matching upstream SDK dependencies. Forecasting cells use pandas' `include_groups` API (pandas 2.2 or later). These are prerequisites, not a tested installation recipe. The missing helper expected upstream code under `.runtime/NV-Tesseract` and model-family asset directories beside it. Its preparation step downloads assets; its activation step checks revisions and hashes before loading. The forecasting and anomaly packages share the `sdk` namespace and require separate fresh kernels.\n",
    "\n",
    "Retained identities for an independently reviewed reconstruction:\n",
    "\n",
    "- Upstream [NVIDIA/NV-Tesseract](https://github.com/NVIDIA/NV-Tesseract), revision `7fa53ac50abcd8829550d9399875f24170c1d0e8`.\n",
    "- Forecasting model: `nvidia/nv-tesseract-forecasting`, revision `abff20a58834638b28227ff4ab934f26206e4b09`; required files include `run8_best_model_cr.pt` and `standardizer.pkl`.\n",
    "- Backbone: `AutonLab/MOMENT-1-large`, revision `ca58581bc7bea2ebed4e80dc0a3e4b8b609c6ecc`; required files include `config.json` and `model.safetensors`.\n",
    "\n",
    "Use the official source and model cards linked below to review licenses, hardware support and security requirements before acquiring assets. Checkpoint and standardizer loading can deserialize code-capable formats; verify provenance and hashes in a disposable environment. The public download includes no weights or credentials. A complete helper distribution, dependency lock and clean-environment smoke test remain unverified; this page does not offer a one-command rerun.\n",
    "\n",
    "**Evidence:** these are saved outputs from an earlier execution, not rerun for the 2026-10-29 editorial update. Rendering displays saved cells; it does not execute them. The public download is not a locked environment or a production validation.\n"
   ]
  },
  {
   "id": "cell-01",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 1,
   "source": [
    "from pathlib import Path\n",
    "import sys, time, json, hashlib\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from IPython.display import display, Markdown, JSON\n",
    "# Requires the separately prepared runtime described above; the public download is dependency-incomplete.\n",
    "from time_series_lab import activate, features, anomaly_metrics, style, LOCK, RUNTIME\n",
    "style()\n",
    "weights = activate('forecast')\n",
    "import torch\n",
    "from dataclasses import replace\n",
    "from sdk.forecasting import ForecastingConfig, perform_forecasting\n",
    "DEVICE = 'mps' if torch.backends.mps.is_available() else 'cuda' if torch.cuda.is_available() else 'cpu'\n",
    "print({'model': 'NV-Tesseract Forecasting', 'device': DEVICE,\n",
    "       'checkpoint_revision': LOCK['forecast']['revision'], 'backbone_revision': LOCK['backbone']['revision']})\n"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'model': 'NV-Tesseract Forecasting', 'device': 'mps', 'checkpoint_revision': 'abff20a58834638b28227ff4ab934f26206e4b09', 'backbone_revision': 'ca58581bc7bea2ebed4e80dc0a3e4b8b609c6ecc'}\n"
     ]
    }
   ]
  },
  {
   "id": "cell-02",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## Build a dataset with business structure\n",
    "\n",
    "This fixture has hourly seasonality, a weekly cycle, trend, correlated workload signals, and random noise. It is not a real retailer or bank extract. A reproducible synthetic fixture lets us inspect the mechanics without exposing customer records; it does **not** establish real-world generalization.\n"
   ]
  },
  {
   "id": "cell-03",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 2,
   "source": [
    "rng = np.random.default_rng(23)\n",
    "t = np.arange(1500)\n",
    "daily = np.sin(2*np.pi*t/24 - .5)\n",
    "weekly = np.cos(2*np.pi*t/168)\n",
    "values = 100 + 28*daily + 12*weekly + .012*t + rng.normal(0,4,len(t))\n",
    "df = pd.DataFrame({\n",
    "    'timestamp': pd.date_range('2026-01-01', periods=len(t), freq='h'),\n",
    "    'orders_per_hour': values,\n",
    "    'activity_index': 50 + 12*daily + 6*weekly + rng.normal(0,1,len(t)),\n",
    "    'upstream_volume': 200 + 35*daily + .02*t + rng.normal(0,3,len(t)),\n",
    "})\n",
    "TARGET = 'orders_per_hour'\n",
    "columns = [TARGET, 'activity_index', 'upstream_volume']\n",
    "features(df, columns)  # Reject missing data, duplicate/out-of-order timestamps and labels.\n",
    "origins = [1280, 1352, 1424]\n",
    "HORIZON = 72\n",
    "assert all(b-a >= HORIZON for a,b in zip(origins,origins[1:]))\n",
    "fig, ax = plt.subplots(figsize=(11,4))\n",
    "ax.plot(df.timestamp, df[TARGET], linewidth=.8)\n",
    "for origin in origins:\n",
    "    ax.axvspan(df.timestamp[origin], df.timestamp[origin+HORIZON-1], alpha=.12)\n",
    "ax.set(title='Synthetic workload and three predeclared future blocks', ylabel=TARGET.replace('_',' '))\n",
    "plt.tight_layout(); plt.show()\n",
    "display(df.head())\n"
   ],
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"786.016406pt\" height=\"282.96pt\" viewBox=\"0 0 786.016406 282.96\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2026-10-06T14:15:30.389263</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.11.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 282.96 \n",
       "L 786.016406 282.96 \n",
       "L 786.016406 0 \n",
       "L 0 0 \n",
       "L 0 282.96 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 43.861406 259.8575 \n",
       "L 778.816406 259.8575 \n",
       "L 778.816406 29.925 \n",
       "L 43.861406 29.925 \n",
       "L 43.861406 259.8575 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"77.268452\" y=\"273.9495\" transform=\"rotate(-0 77.268452 273.9495)\">2026-01-01</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"152.150155\" y=\"273.9495\" transform=\"rotate(-0 152.150155 273.9495)\">2026-01-08</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"227.031858\" y=\"273.9495\" transform=\"rotate(-0 227.031858 273.9495)\">2026-01-15</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"301.913561\" y=\"273.9495\" transform=\"rotate(-0 301.913561 273.9495)\">2026-01-22</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"408.887422\" y=\"273.9495\" transform=\"rotate(-0 408.887422 273.9495)\">2026-02-01</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_6\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"483.769125\" y=\"273.9495\" transform=\"rotate(-0 483.769125 273.9495)\">2026-02-08</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_7\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"558.650828\" y=\"273.9495\" transform=\"rotate(-0 558.650828 273.9495)\">2026-02-15</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"633.532531\" y=\"273.9495\" transform=\"rotate(-0 633.532531 273.9495)\">2026-02-22</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_9\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"708.414234\" y=\"273.9495\" transform=\"rotate(-0 708.414234 273.9495)\">2026-03-01</text>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <path d=\"M 43.861406 232.578651 \n",
       "L 778.816406 232.578651 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_11\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"236.624651\" transform=\"rotate(-0 37.861406 236.624651)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <path d=\"M 43.861406 194.768676 \n",
       "L 778.816406 194.768676 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_13\"/>\n",
       "     <g id=\"text_11\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"198.814676\" transform=\"rotate(-0 37.861406 198.814676)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <path d=\"M 43.861406 156.958701 \n",
       "L 778.816406 156.958701 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_15\"/>\n",
       "     <g id=\"text_12\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"161.004701\" transform=\"rotate(-0 37.861406 161.004701)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_16\">\n",
       "      <path d=\"M 43.861406 119.148726 \n",
       "L 778.816406 119.148726 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_17\"/>\n",
       "     <g id=\"text_13\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"123.194726\" transform=\"rotate(-0 37.861406 123.194726)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <path d=\"M 43.861406 81.33875 \n",
       "L 778.816406 81.33875 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_19\"/>\n",
       "     <g id=\"text_14\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"85.38475\" transform=\"rotate(-0 37.861406 85.38475)\">140</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <path d=\"M 43.861406 43.528775 \n",
       "L 778.816406 43.528775 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_21\"/>\n",
       "     <g id=\"text_15\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"47.574775\" transform=\"rotate(-0 37.861406 47.574775)\">160</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_16\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #484945\" x=\"15.768\" y=\"144.89125\" transform=\"rotate(-90 15.768 144.89125)\">orders per hour</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 647.795712 259.8575 \n",
       "L 679.442146 259.8575 \n",
       "L 679.442146 29.925 \n",
       "L 647.795712 29.925 \n",
       "z\n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: #0969da; opacity: 0.12\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 679.887871 259.8575 \n",
       "L 711.534305 259.8575 \n",
       "L 711.534305 29.925 \n",
       "L 679.887871 29.925 \n",
       "z\n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: #0969da; opacity: 0.12\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 711.980029 259.8575 \n",
       "L 743.626463 259.8575 \n",
       "L 743.626463 29.925 \n",
       "L 711.980029 29.925 \n",
       "z\n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: #0969da; opacity: 0.12\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_22\">\n",
       "    <path d=\"M 77.268452 155.466857 \n",
       "L 78.159901 133.480238 \n",
       "L 78.605625 136.980082 \n",
       "L 79.051349 103.631067 \n",
       "L 79.497074 112.330936 \n",
       "L 79.942798 81.37064 \n",
       "L 80.834247 75.902992 \n",
       "L 81.279972 78.289786 \n",
       "L 81.725696 88.151824 \n",
       "L 82.17142 103.425391 \n",
       "L 82.617145 113.191211 \n",
       "L 83.062869 112.712716 \n",
       "L 83.508594 142.646334 \n",
       "L 83.954318 154.037713 \n",
       "L 84.400042 170.871791 \n",
       "L 84.845767 180.534146 \n",
       "L 85.291491 187.58585 \n",
       "L 85.737216 188.831618 \n",
       "L 86.18294 195.016342 \n",
       "L 86.628665 193.915952 \n",
       "L 87.074389 190.898438 \n",
       "L 87.520113 177.498028 \n",
       "L 87.965838 177.812228 \n",
       "L 88.857287 132.433926 \n",
       "L 89.303011 135.172895 \n",
       "L 89.748736 117.782421 \n",
       "L 90.19446 86.093874 \n",
       "L 90.640184 107.487715 \n",
       "L 91.085909 108.003227 \n",
       "L 91.531633 98.25293 \n",
       "L 91.977358 84.260535 \n",
       "L 92.423082 88.906168 \n",
       "L 92.868806 122.952092 \n",
       "L 93.314531 121.404604 \n",
       "L 94.20598 158.41378 \n",
       "L 94.651704 183.150284 \n",
       "L 95.097429 174.149368 \n",
       "L 95.543153 199.990469 \n",
       "L 95.988877 200.19872 \n",
       "L 96.434602 207.651506 \n",
       "L 96.880326 196.432768 \n",
       "L 97.326051 200.377756 \n",
       "L 97.771775 213.237826 \n",
       "L 98.2175 198.630603 \n",
       "L 98.663224 178.455139 \n",
       "L 99.108948 184.288909 \n",
       "L 100.000397 146.670491 \n",
       "L 100.446122 148.744688 \n",
       "L 100.891846 135.868053 \n",
       "L 101.337571 132.009035 \n",
       "L 101.783295 112.701982 \n",
       "L 102.229019 118.358221 \n",
       "L 102.674744 109.920071 \n",
       "L 103.120468 122.357009 \n",
       "L 103.566193 128.229708 \n",
       "L 104.011917 144.996884 \n",
       "L 104.457641 152.196591 \n",
       "L 105.34909 193.901305 \n",
       "L 105.794815 190.734045 \n",
       "L 106.240539 203.571394 \n",
       "L 106.686264 202.511245 \n",
       "L 107.131988 226.206484 \n",
       "L 108.023437 236.337435 \n",
       "L 108.469161 249.406023 \n",
       "L 109.36061 197.461252 \n",
       "L 109.806335 195.282127 \n",
       "L 110.252059 194.770711 \n",
       "L 110.697783 157.167514 \n",
       "L 111.143508 153.845456 \n",
       "L 111.589232 141.552007 \n",
       "L 112.926405 121.069453 \n",
       "L 113.37213 139.988116 \n",
       "L 113.817854 134.233598 \n",
       "L 114.263579 145.055509 \n",
       "L 114.709303 143.765262 \n",
       "L 115.155028 173.039423 \n",
       "L 115.600752 166.49722 \n",
       "L 116.046476 187.83342 \n",
       "L 116.492201 192.650722 \n",
       "L 116.937925 220.860215 \n",
       "L 117.38365 217.393481 \n",
       "L 117.829374 225.500793 \n",
       "L 118.275099 240.794303 \n",
       "L 118.720823 229.027654 \n",
       "L 119.612272 219.439024 \n",
       "L 120.057996 206.406851 \n",
       "L 120.503721 198.193156 \n",
       "L 121.39517 156.49182 \n",
       "L 122.286618 146.438294 \n",
       "L 122.732343 118.022642 \n",
       "L 123.178067 123.18215 \n",
       "L 123.623792 118.10275 \n",
       "L 124.069516 121.594398 \n",
       "L 124.51524 128.863885 \n",
       "L 124.960965 128.242262 \n",
       "L 125.406689 147.282348 \n",
       "L 125.852414 155.250085 \n",
       "L 126.298138 179.418417 \n",
       "L 126.743863 193.805571 \n",
       "L 127.189587 196.248022 \n",
       "L 127.635311 188.849908 \n",
       "L 128.081036 209.298797 \n",
       "L 128.52676 200.238984 \n",
       "L 128.972485 212.115057 \n",
       "L 129.418209 209.160856 \n",
       "L 129.863934 210.584521 \n",
       "L 130.309658 196.83648 \n",
       "L 130.755382 171.11669 \n",
       "L 131.201107 161.95889 \n",
       "L 131.646831 161.058361 \n",
       "L 132.092556 145.358099 \n",
       "L 132.53828 118.187417 \n",
       "L 132.984004 120.561249 \n",
       "L 133.429729 100.691269 \n",
       "L 133.875453 108.668102 \n",
       "L 134.321178 94.691284 \n",
       "L 134.766902 89.158285 \n",
       "L 135.658351 111.392002 \n",
       "L 136.5498 136.21931 \n",
       "L 136.995524 148.655418 \n",
       "L 137.441249 152.392141 \n",
       "L 137.886973 164.400794 \n",
       "L 138.332698 179.997666 \n",
       "L 138.778422 199.961047 \n",
       "L 139.224146 198.581446 \n",
       "L 139.669871 193.109953 \n",
       "L 140.115595 192.093663 \n",
       "L 140.56132 196.393811 \n",
       "L 141.452769 145.272986 \n",
       "L 141.898493 160.63655 \n",
       "L 142.789942 110.43061 \n",
       "L 143.235666 112.585824 \n",
       "L 144.572839 79.553183 \n",
       "L 145.018564 84.956624 \n",
       "L 145.464288 76.076854 \n",
       "L 145.910013 103.019134 \n",
       "L 146.355737 91.892723 \n",
       "L 146.801462 104.81378 \n",
       "L 147.247186 121.315549 \n",
       "L 147.69291 130.576317 \n",
       "L 148.138635 146.479658 \n",
       "L 148.584359 149.136082 \n",
       "L 149.030084 173.187503 \n",
       "L 149.475808 177.933506 \n",
       "L 149.921533 192.903164 \n",
       "L 150.367257 192.230376 \n",
       "L 150.812981 183.287251 \n",
       "L 151.258706 187.541819 \n",
       "L 151.70443 173.443533 \n",
       "L 152.150155 165.866731 \n",
       "L 153.487328 108.498031 \n",
       "L 153.933052 117.757646 \n",
       "L 154.378777 93.955736 \n",
       "L 154.824501 77.89374 \n",
       "L 155.270226 69.199808 \n",
       "L 155.71595 67.735929 \n",
       "L 156.161674 91.583962 \n",
       "L 156.607399 90.478304 \n",
       "L 157.053123 91.302084 \n",
       "L 157.498848 99.95934 \n",
       "L 158.390297 132.42391 \n",
       "L 158.836021 146.678211 \n",
       "L 159.281745 167.384549 \n",
       "L 160.173194 175.314284 \n",
       "L 160.618919 189.524463 \n",
       "L 161.064643 180.113983 \n",
       "L 161.510368 208.91461 \n",
       "L 162.401816 161.507163 \n",
       "L 162.847541 157.230598 \n",
       "L 163.293265 140.678085 \n",
       "L 164.184714 134.49845 \n",
       "L 164.630438 117.487952 \n",
       "L 165.076163 92.075502 \n",
       "L 165.521887 110.058091 \n",
       "L 165.967612 99.144275 \n",
       "L 166.413336 104.17492 \n",
       "L 166.859061 98.14869 \n",
       "L 167.304785 103.669856 \n",
       "L 167.750509 105.560081 \n",
       "L 168.196234 128.135203 \n",
       "L 168.641958 122.643004 \n",
       "L 169.979132 185.580447 \n",
       "L 170.424856 200.998622 \n",
       "L 170.87058 197.715711 \n",
       "L 171.316305 189.458702 \n",
       "L 171.762029 207.977257 \n",
       "L 172.207754 213.219068 \n",
       "L 172.653478 201.112511 \n",
       "L 173.099203 196.721344 \n",
       "L 173.544927 189.301439 \n",
       "L 173.990651 184.716208 \n",
       "L 174.8821 133.321157 \n",
       "L 175.773549 115.246258 \n",
       "L 176.219273 113.686512 \n",
       "L 177.110722 102.608864 \n",
       "L 177.556447 113.49242 \n",
       "L 178.002171 117.218441 \n",
       "L 178.447896 131.703999 \n",
       "L 178.89362 131.926285 \n",
       "L 179.339344 161.014876 \n",
       "L 179.785069 163.201841 \n",
       "L 181.122242 201.715806 \n",
       "L 181.567967 219.274747 \n",
       "L 182.013691 225.507031 \n",
       "L 182.459415 226.30356 \n",
       "L 182.90514 224.337193 \n",
       "L 183.350864 224.843029 \n",
       "L 183.796589 211.41536 \n",
       "L 184.688037 191.859121 \n",
       "L 185.133762 168.496568 \n",
       "L 185.579486 163.583975 \n",
       "L 186.470935 123.767855 \n",
       "L 186.91666 114.164129 \n",
       "L 187.362384 121.948993 \n",
       "L 187.808108 112.995304 \n",
       "L 188.253833 121.044005 \n",
       "L 188.699557 110.473226 \n",
       "L 189.591006 139.953475 \n",
       "L 190.036731 162.445437 \n",
       "L 190.482455 176.825417 \n",
       "L 190.928179 184.337428 \n",
       "L 191.373904 201.230437 \n",
       "L 191.819628 213.450962 \n",
       "L 192.265353 214.264894 \n",
       "L 192.711077 233.763517 \n",
       "L 193.156802 240.700748 \n",
       "L 193.602526 230.830172 \n",
       "L 194.04825 225.994521 \n",
       "L 194.493975 208.836019 \n",
       "L 194.939699 203.284647 \n",
       "L 195.385424 184.875758 \n",
       "L 195.831148 184.578834 \n",
       "L 196.276872 143.940481 \n",
       "L 196.722597 138.975874 \n",
       "L 197.168321 137.275086 \n",
       "L 197.614046 119.62421 \n",
       "L 198.05977 107.124965 \n",
       "L 198.505495 108.014388 \n",
       "L 198.951219 116.606661 \n",
       "L 199.396943 116.207157 \n",
       "L 199.842668 122.164079 \n",
       "L 200.288392 148.559389 \n",
       "L 200.734117 162.510804 \n",
       "L 201.179841 169.111 \n",
       "L 201.625566 170.032778 \n",
       "L 202.07129 178.175764 \n",
       "L 202.517014 198.380728 \n",
       "L 202.962739 195.321936 \n",
       "L 203.854188 212.174687 \n",
       "L 204.299912 214.354375 \n",
       "L 204.745636 207.162137 \n",
       "L 205.191361 192.14617 \n",
       "L 205.637085 170.070214 \n",
       "L 206.08281 160.628271 \n",
       "L 206.528534 162.344916 \n",
       "L 206.974259 147.243458 \n",
       "L 207.419983 118.205086 \n",
       "L 207.865707 111.267137 \n",
       "L 208.311432 110.940816 \n",
       "L 208.757156 92.7227 \n",
       "L 209.202881 85.129962 \n",
       "L 209.648605 90.708906 \n",
       "L 210.09433 100.688484 \n",
       "L 210.540054 99.13286 \n",
       "L 210.985778 122.551748 \n",
       "L 211.877227 151.573725 \n",
       "L 212.322952 142.963235 \n",
       "L 212.768676 153.032128 \n",
       "L 213.214401 179.45391 \n",
       "L 213.660125 181.984089 \n",
       "L 214.105849 187.248456 \n",
       "L 214.551574 184.282401 \n",
       "L 214.997298 179.448246 \n",
       "L 215.443023 177.016588 \n",
       "L 215.888747 173.513142 \n",
       "L 216.780196 155.149457 \n",
       "L 217.22592 152.888562 \n",
       "L 217.671645 119.441136 \n",
       "L 218.117369 111.79808 \n",
       "L 218.563094 93.880299 \n",
       "L 219.008818 86.194995 \n",
       "L 219.454542 87.685883 \n",
       "L 220.345991 76.37373 \n",
       "L 220.791716 83.367665 \n",
       "L 221.23744 99.589879 \n",
       "L 221.683165 109.37093 \n",
       "L 222.128889 111.819476 \n",
       "L 223.466062 156.475507 \n",
       "L 223.911787 160.115669 \n",
       "L 224.357511 172.946073 \n",
       "L 224.803235 159.26161 \n",
       "L 225.24896 183.350707 \n",
       "L 225.694684 182.849821 \n",
       "L 226.140409 159.285143 \n",
       "L 226.586133 163.634093 \n",
       "L 227.031858 157.806217 \n",
       "L 227.477582 135.70951 \n",
       "L 227.923306 142.859094 \n",
       "L 228.369031 108.305925 \n",
       "L 228.814755 98.999367 \n",
       "L 229.26048 86.474797 \n",
       "L 229.706204 86.605267 \n",
       "L 230.151929 65.73469 \n",
       "L 231.043377 76.957275 \n",
       "L 231.489102 79.926542 \n",
       "L 231.934826 97.978611 \n",
       "L 232.380551 104.112916 \n",
       "L 232.826275 127.772551 \n",
       "L 233.272 138.889054 \n",
       "L 233.717724 142.371182 \n",
       "L 234.163448 156.79092 \n",
       "L 234.609173 163.29562 \n",
       "L 235.054897 182.590107 \n",
       "L 235.500622 183.92134 \n",
       "L 235.946346 190.309808 \n",
       "L 237.729244 155.666045 \n",
       "L 238.174968 153.760577 \n",
       "L 238.620693 133.105904 \n",
       "L 239.066417 129.588934 \n",
       "L 239.512141 124.346665 \n",
       "L 239.957866 98.465685 \n",
       "L 240.40359 91.737888 \n",
       "L 240.849315 82.517475 \n",
       "L 241.295039 81.192038 \n",
       "L 241.740764 99.669979 \n",
       "L 242.186488 103.589912 \n",
       "L 242.632212 106.232939 \n",
       "L 243.523661 128.770728 \n",
       "L 243.969386 156.307314 \n",
       "L 244.860835 169.519032 \n",
       "L 245.306559 171.622627 \n",
       "L 245.752283 204.432185 \n",
       "L 246.198008 188.509295 \n",
       "L 246.643732 205.235834 \n",
       "L 247.089457 212.691092 \n",
       "L 247.535181 186.946167 \n",
       "L 247.980905 197.236592 \n",
       "L 248.42663 187.651284 \n",
       "L 248.872354 161.305523 \n",
       "L 249.318079 145.964664 \n",
       "L 250.655252 130.358466 \n",
       "L 251.100976 110.875161 \n",
       "L 251.546701 125.123921 \n",
       "L 251.992425 117.698788 \n",
       "L 252.43815 101.524807 \n",
       "L 252.883874 111.135211 \n",
       "L 253.329599 115.938006 \n",
       "L 253.775323 133.893022 \n",
       "L 254.221047 159.14813 \n",
       "L 254.666772 161.305059 \n",
       "L 255.112496 192.806093 \n",
       "L 255.558221 187.078434 \n",
       "L 256.003945 193.33124 \n",
       "L 256.449669 219.898154 \n",
       "L 256.895394 210.050957 \n",
       "L 257.341118 219.478834 \n",
       "L 257.786843 219.314237 \n",
       "L 258.232567 227.853753 \n",
       "L 259.124016 187.296276 \n",
       "L 259.56974 194.271749 \n",
       "L 260.015465 171.521723 \n",
       "L 260.461189 159.821695 \n",
       "L 260.906914 154.412065 \n",
       "L 261.352638 123.657577 \n",
       "L 261.798363 123.436516 \n",
       "L 262.244087 118.432986 \n",
       "L 262.689811 109.953322 \n",
       "L 263.135536 125.286097 \n",
       "L 263.58126 100.630288 \n",
       "L 264.026985 137.4085 \n",
       "L 264.472709 153.872406 \n",
       "L 264.918434 153.116212 \n",
       "L 265.364158 168.68572 \n",
       "L 265.809882 192.342475 \n",
       "L 266.255607 204.397353 \n",
       "L 266.701331 201.841661 \n",
       "L 267.147056 213.847521 \n",
       "L 267.59278 217.668987 \n",
       "L 268.038504 215.422184 \n",
       "L 268.484229 224.133893 \n",
       "L 268.929953 204.097777 \n",
       "L 269.375678 204.381205 \n",
       "L 269.821402 187.600033 \n",
       "L 270.267127 186.673589 \n",
       "L 270.712851 159.863041 \n",
       "L 271.158575 149.300504 \n",
       "L 271.6043 119.545253 \n",
       "L 272.050024 128.129618 \n",
       "L 272.495749 106.718399 \n",
       "L 272.941473 107.892685 \n",
       "L 273.387198 98.763489 \n",
       "L 273.832922 110.322362 \n",
       "L 274.278646 113.416322 \n",
       "L 274.724371 141.820759 \n",
       "L 275.170095 145.191947 \n",
       "L 275.61582 139.829636 \n",
       "L 276.061544 157.54425 \n",
       "L 276.507268 167.824904 \n",
       "L 276.952993 187.525108 \n",
       "L 277.398717 189.612388 \n",
       "L 277.844442 205.605306 \n",
       "L 278.290166 207.533207 \n",
       "L 278.735891 198.591829 \n",
       "L 279.181615 196.686497 \n",
       "L 279.627339 201.706649 \n",
       "L 281.410237 149.32155 \n",
       "L 281.855962 141.163476 \n",
       "L 282.301686 116.25879 \n",
       "L 282.74741 116.803997 \n",
       "L 283.193135 107.167308 \n",
       "L 283.638859 84.445818 \n",
       "L 284.084584 77.895179 \n",
       "L 284.530308 79.007838 \n",
       "L 285.421757 109.527191 \n",
       "L 285.867481 110.186115 \n",
       "L 286.313206 116.127756 \n",
       "L 286.75893 139.847216 \n",
       "L 287.204655 156.601218 \n",
       "L 287.650379 177.957767 \n",
       "L 288.096103 188.067333 \n",
       "L 288.541828 169.733375 \n",
       "L 288.987552 197.983954 \n",
       "L 289.879001 187.018373 \n",
       "L 290.324726 176.600369 \n",
       "L 290.77045 178.846286 \n",
       "L 291.216174 152.93113 \n",
       "L 292.107623 128.743987 \n",
       "L 292.553348 119.691388 \n",
       "L 292.999072 104.55659 \n",
       "L 293.444797 104.966323 \n",
       "L 293.890521 76.990891 \n",
       "L 294.336245 80.151856 \n",
       "L 294.78197 84.546235 \n",
       "L 295.227694 76.154215 \n",
       "L 295.673419 77.269988 \n",
       "L 297.010592 103.735653 \n",
       "L 297.456316 129.909292 \n",
       "L 297.902041 137.871163 \n",
       "L 298.347765 149.734218 \n",
       "L 298.79349 173.156819 \n",
       "L 299.239214 161.899325 \n",
       "L 299.684938 177.393024 \n",
       "L 300.576387 171.744602 \n",
       "L 301.022112 174.468354 \n",
       "L 301.467836 153.404823 \n",
       "L 301.913561 141.05666 \n",
       "L 302.359285 134.220569 \n",
       "L 302.805009 143.624689 \n",
       "L 303.250734 97.930956 \n",
       "L 303.696458 96.769244 \n",
       "L 304.587907 81.425353 \n",
       "L 305.033632 80.383371 \n",
       "L 305.92508 68.665588 \n",
       "L 306.370805 87.525196 \n",
       "L 306.816529 86.567961 \n",
       "L 307.262254 104.134282 \n",
       "L 307.707978 114.842438 \n",
       "L 308.153702 129.809055 \n",
       "L 309.045151 146.540056 \n",
       "L 309.490876 165.485672 \n",
       "L 309.9366 167.272586 \n",
       "L 310.382325 168.332717 \n",
       "L 310.828049 192.491662 \n",
       "L 311.273773 174.087085 \n",
       "L 311.719498 177.256964 \n",
       "L 312.165222 168.331709 \n",
       "L 312.610947 149.05375 \n",
       "L 313.056671 145.917357 \n",
       "L 313.502396 135.821794 \n",
       "L 313.94812 108.560969 \n",
       "L 314.393844 98.221516 \n",
       "L 314.839569 92.945557 \n",
       "L 315.285293 67.329834 \n",
       "L 315.731018 91.81462 \n",
       "L 316.176742 95.908879 \n",
       "L 316.622467 88.151614 \n",
       "L 317.068191 101.468891 \n",
       "L 317.513915 99.554864 \n",
       "L 317.95964 118.751826 \n",
       "L 318.405364 132.514654 \n",
       "L 318.851089 142.479884 \n",
       "L 319.742537 184.962043 \n",
       "L 320.188262 187.545125 \n",
       "L 320.633986 185.732182 \n",
       "L 321.079711 195.067193 \n",
       "L 321.525435 192.112976 \n",
       "L 321.97116 185.147791 \n",
       "L 322.416884 186.449127 \n",
       "L 322.862608 185.657262 \n",
       "L 323.308333 180.530045 \n",
       "L 324.199782 137.718314 \n",
       "L 324.645506 126.228176 \n",
       "L 325.091231 118.037778 \n",
       "L 325.536955 121.146074 \n",
       "L 325.982679 103.295239 \n",
       "L 326.874128 93.428308 \n",
       "L 327.319853 115.061907 \n",
       "L 327.765577 117.031758 \n",
       "L 328.211301 120.077409 \n",
       "L 328.657026 131.986335 \n",
       "L 329.10275 151.038343 \n",
       "L 329.548475 157.018996 \n",
       "L 329.994199 177.25397 \n",
       "L 330.439924 179.887528 \n",
       "L 330.885648 203.217327 \n",
       "L 331.331372 206.717595 \n",
       "L 331.777097 229.507284 \n",
       "L 332.222821 214.10928 \n",
       "L 332.668546 218.968662 \n",
       "L 333.11427 203.434313 \n",
       "L 333.559995 201.800326 \n",
       "L 334.005719 180.432584 \n",
       "L 334.451443 181.155847 \n",
       "L 334.897168 174.540727 \n",
       "L 335.342892 148.52289 \n",
       "L 335.788617 133.555402 \n",
       "L 336.234341 133.000913 \n",
       "L 336.680066 129.191093 \n",
       "L 337.12579 108.873165 \n",
       "L 337.571514 105.27897 \n",
       "L 338.017239 109.914045 \n",
       "L 338.908688 129.766364 \n",
       "L 339.354412 128.602994 \n",
       "L 339.800136 147.715265 \n",
       "L 340.245861 174.270619 \n",
       "L 340.691585 189.09487 \n",
       "L 341.13731 188.768426 \n",
       "L 341.583034 198.560058 \n",
       "L 342.028759 216.64986 \n",
       "L 342.474483 222.503962 \n",
       "L 342.920207 210.728667 \n",
       "L 343.365932 217.967162 \n",
       "L 343.811656 203.384622 \n",
       "L 344.257381 208.996761 \n",
       "L 344.703105 196.576852 \n",
       "L 345.14883 188.727302 \n",
       "L 345.594554 161.903452 \n",
       "L 346.040278 150.584665 \n",
       "L 346.486003 147.080365 \n",
       "L 346.931727 121.983316 \n",
       "L 347.377452 118.449903 \n",
       "L 347.823176 110.589918 \n",
       "L 348.2689 96.311371 \n",
       "L 348.714625 101.061612 \n",
       "L 349.160349 109.60469 \n",
       "L 350.497523 148.962524 \n",
       "L 350.943247 159.869515 \n",
       "L 351.388971 160.489521 \n",
       "L 351.834696 188.828236 \n",
       "L 352.28042 195.9557 \n",
       "L 352.726145 199.299691 \n",
       "L 353.171869 200.474999 \n",
       "L 354.063318 191.139641 \n",
       "L 354.509042 195.857686 \n",
       "L 354.954767 170.701408 \n",
       "L 355.846216 165.406749 \n",
       "L 356.29194 152.254278 \n",
       "L 357.629113 99.289409 \n",
       "L 358.074838 102.379076 \n",
       "L 358.520562 94.665194 \n",
       "L 358.966287 94.425858 \n",
       "L 359.412011 87.264941 \n",
       "L 359.857735 104.963754 \n",
       "L 360.30346 97.66286 \n",
       "L 360.749184 118.086829 \n",
       "L 361.640633 133.806875 \n",
       "L 362.086358 147.645293 \n",
       "L 362.532082 140.725211 \n",
       "L 362.977806 178.527186 \n",
       "L 363.423531 194.753463 \n",
       "L 363.869255 193.120617 \n",
       "L 364.31498 177.702659 \n",
       "L 364.760704 189.141684 \n",
       "L 365.206429 167.012137 \n",
       "L 365.652153 167.013008 \n",
       "L 366.097877 147.913629 \n",
       "L 366.543602 151.492031 \n",
       "L 366.989326 117.711259 \n",
       "L 367.435051 102.546262 \n",
       "L 367.880775 105.050387 \n",
       "L 368.326499 76.71554 \n",
       "L 368.772224 58.088141 \n",
       "L 369.217948 72.438235 \n",
       "L 369.663673 77.500688 \n",
       "L 370.109397 76.580814 \n",
       "L 370.555122 79.371042 \n",
       "L 371.000846 77.811824 \n",
       "L 371.44657 82.379599 \n",
       "L 371.892295 111.834811 \n",
       "L 372.338019 123.787124 \n",
       "L 372.783744 145.88858 \n",
       "L 373.229468 151.715876 \n",
       "L 373.675193 154.716181 \n",
       "L 374.120917 181.35051 \n",
       "L 374.566641 165.785728 \n",
       "L 375.012366 165.544458 \n",
       "L 375.45809 160.931636 \n",
       "L 375.903815 168.660141 \n",
       "L 376.349539 167.446211 \n",
       "L 376.795264 146.519111 \n",
       "L 377.686712 131.106895 \n",
       "L 378.132437 109.950221 \n",
       "L 378.578161 102.171533 \n",
       "L 379.023886 66.480295 \n",
       "L 379.46961 67.375143 \n",
       "L 379.915334 61.569654 \n",
       "L 380.361059 75.322245 \n",
       "L 380.806783 58.955142 \n",
       "L 381.252508 78.00519 \n",
       "L 381.698232 77.71627 \n",
       "L 382.143957 103.330595 \n",
       "L 382.589681 104.166962 \n",
       "L 383.035405 135.656418 \n",
       "L 383.48113 138.385771 \n",
       "L 383.926854 151.99063 \n",
       "L 384.372579 171.706059 \n",
       "L 384.818303 169.830583 \n",
       "L 385.264028 179.831956 \n",
       "L 385.709752 180.545938 \n",
       "L 386.601201 161.222163 \n",
       "L 387.046925 164.438447 \n",
       "L 387.49265 142.720801 \n",
       "L 388.384098 121.477681 \n",
       "L 388.829823 102.148581 \n",
       "L 389.275547 113.553525 \n",
       "L 389.721272 82.11229 \n",
       "L 390.166996 81.887657 \n",
       "L 390.612721 83.445782 \n",
       "L 391.058445 81.041073 \n",
       "L 391.504169 74.990185 \n",
       "L 391.949894 79.973129 \n",
       "L 392.395618 93.079181 \n",
       "L 392.841343 119.195074 \n",
       "L 393.287067 135.169163 \n",
       "L 393.732792 138.342764 \n",
       "L 394.178516 148.344721 \n",
       "L 394.62424 171.800896 \n",
       "L 395.069965 171.523127 \n",
       "L 395.515689 182.540879 \n",
       "L 395.961414 189.297724 \n",
       "L 396.407138 200.992802 \n",
       "L 396.852863 184.550316 \n",
       "L 397.298587 181.846259 \n",
       "L 397.744311 171.068716 \n",
       "L 398.190036 168.077691 \n",
       "L 398.63576 168.383422 \n",
       "L 399.081485 143.025858 \n",
       "L 399.527209 126.486191 \n",
       "L 399.972933 122.208401 \n",
       "L 400.418658 119.779907 \n",
       "L 400.864382 99.546128 \n",
       "L 401.310107 94.665876 \n",
       "L 401.755831 108.20347 \n",
       "L 402.201556 107.06641 \n",
       "L 402.64728 118.796381 \n",
       "L 403.093004 114.767029 \n",
       "L 403.538729 127.700829 \n",
       "L 403.984453 129.47127 \n",
       "L 404.430178 163.834966 \n",
       "L 404.875902 161.151046 \n",
       "L 405.321627 186.045866 \n",
       "L 405.767351 193.671765 \n",
       "L 406.213075 213.692821 \n",
       "L 406.6588 209.678555 \n",
       "L 407.104524 215.809142 \n",
       "L 407.550249 210.971705 \n",
       "L 407.995973 203.576202 \n",
       "L 408.441698 193.022193 \n",
       "L 408.887422 179.596468 \n",
       "L 409.778871 166.615832 \n",
       "L 410.224595 138.769525 \n",
       "L 411.116044 128.113409 \n",
       "L 411.561768 105.240776 \n",
       "L 412.007493 108.559557 \n",
       "L 412.453217 103.915507 \n",
       "L 412.898942 124.356272 \n",
       "L 413.344666 121.925302 \n",
       "L 413.790391 110.730369 \n",
       "L 414.236115 133.28658 \n",
       "L 414.681839 146.278501 \n",
       "L 415.127564 168.930626 \n",
       "L 416.019013 186.866606 \n",
       "L 416.464737 200.821434 \n",
       "L 416.910462 209.070059 \n",
       "L 417.356186 226.217975 \n",
       "L 418.247635 215.210374 \n",
       "L 418.693359 201.659979 \n",
       "L 420.030532 177.556698 \n",
       "L 420.476257 163.39157 \n",
       "L 420.921981 141.965266 \n",
       "L 421.367706 140.90629 \n",
       "L 421.81343 121.11169 \n",
       "L 422.259155 113.126774 \n",
       "L 422.704879 107.144644 \n",
       "L 423.150603 90.674086 \n",
       "L 423.596328 105.778334 \n",
       "L 424.042052 103.15917 \n",
       "L 424.487777 105.650248 \n",
       "L 425.82495 162.81178 \n",
       "L 426.270674 154.088325 \n",
       "L 426.716399 186.544418 \n",
       "L 427.162123 203.576133 \n",
       "L 427.607848 187.555926 \n",
       "L 428.053572 210.823614 \n",
       "L 428.499297 209.503548 \n",
       "L 428.945021 202.934797 \n",
       "L 429.390745 200.108543 \n",
       "L 429.83647 198.102892 \n",
       "L 430.282194 168.266383 \n",
       "L 431.173643 135.70762 \n",
       "L 432.065092 116.428147 \n",
       "L 432.510816 105.794943 \n",
       "L 432.956541 83.619221 \n",
       "L 433.402265 80.593976 \n",
       "L 433.84799 87.899472 \n",
       "L 434.293714 83.535761 \n",
       "L 434.739438 99.478357 \n",
       "L 435.185163 94.632108 \n",
       "L 435.630887 116.807081 \n",
       "L 436.076612 121.87028 \n",
       "L 436.522336 135.441898 \n",
       "L 436.968061 166.701835 \n",
       "L 437.413785 153.295147 \n",
       "L 438.305234 181.570923 \n",
       "L 438.750958 185.306082 \n",
       "L 439.196683 181.405797 \n",
       "L 439.642407 179.011446 \n",
       "L 440.088131 168.084002 \n",
       "L 440.533856 160.965464 \n",
       "L 440.97958 145.665685 \n",
       "L 441.425305 134.829555 \n",
       "L 441.871029 132.73694 \n",
       "L 442.316754 118.500631 \n",
       "L 442.762478 91.191309 \n",
       "L 443.208202 80.399534 \n",
       "L 443.653927 74.662916 \n",
       "L 444.099651 78.907295 \n",
       "L 444.545376 72.388985 \n",
       "L 444.9911 74.805058 \n",
       "L 445.436825 68.860135 \n",
       "L 446.328273 102.993395 \n",
       "L 446.773998 111.303044 \n",
       "L 447.219722 116.411097 \n",
       "L 447.665447 120.208149 \n",
       "L 448.111171 148.101462 \n",
       "L 448.556896 146.491097 \n",
       "L 449.00262 166.152507 \n",
       "L 449.894069 175.261631 \n",
       "L 450.339793 160.691877 \n",
       "L 450.785518 164.537015 \n",
       "L 451.231242 145.066577 \n",
       "L 451.676966 143.966344 \n",
       "L 452.122691 114.983451 \n",
       "L 452.568415 112.640426 \n",
       "L 453.01414 100.255237 \n",
       "L 453.459864 97.002849 \n",
       "L 453.905589 67.761031 \n",
       "L 454.351313 67.137821 \n",
       "L 454.797037 63.990564 \n",
       "L 455.242762 63.114497 \n",
       "L 456.134211 75.357197 \n",
       "L 456.579935 77.842946 \n",
       "L 457.02566 97.897288 \n",
       "L 457.471384 106.200443 \n",
       "L 457.917108 102.311671 \n",
       "L 458.362833 134.256645 \n",
       "L 458.808557 148.494819 \n",
       "L 459.254282 150.868479 \n",
       "L 459.700006 173.553448 \n",
       "L 460.14573 161.263492 \n",
       "L 460.591455 173.7064 \n",
       "L 461.037179 180.917052 \n",
       "L 461.482904 168.258916 \n",
       "L 461.928628 164.32239 \n",
       "L 462.374353 143.416149 \n",
       "L 462.820077 139.827929 \n",
       "L 463.265801 117.888059 \n",
       "L 463.711526 124.730669 \n",
       "L 464.602975 84.097368 \n",
       "L 465.048699 77.152351 \n",
       "L 465.494424 76.236204 \n",
       "L 465.940148 70.36043 \n",
       "L 466.385872 73.046264 \n",
       "L 466.831597 85.264109 \n",
       "L 467.723046 99.933063 \n",
       "L 468.16877 119.114929 \n",
       "L 468.614495 154.10884 \n",
       "L 469.505943 167.75974 \n",
       "L 469.951668 169.318719 \n",
       "L 470.397392 182.934073 \n",
       "L 470.843117 184.379382 \n",
       "L 471.288841 184.012657 \n",
       "L 471.734565 186.164783 \n",
       "L 472.18029 192.551354 \n",
       "L 472.626014 171.341234 \n",
       "L 473.071739 177.421504 \n",
       "L 473.517463 164.867563 \n",
       "L 473.963188 145.64374 \n",
       "L 474.408912 146.526738 \n",
       "L 474.854636 105.150791 \n",
       "L 475.300361 89.990346 \n",
       "L 475.746085 101.621951 \n",
       "L 476.19181 98.99885 \n",
       "L 476.637534 111.089619 \n",
       "L 477.083259 94.317231 \n",
       "L 477.974707 123.024226 \n",
       "L 478.420432 136.220291 \n",
       "L 478.866156 140.272612 \n",
       "L 480.20333 185.850202 \n",
       "L 480.649054 205.517207 \n",
       "L 481.094778 190.474283 \n",
       "L 481.986227 213.101476 \n",
       "L 482.431952 217.162498 \n",
       "L 482.877676 209.420928 \n",
       "L 483.3234 188.374183 \n",
       "L 484.214849 168.077096 \n",
       "L 484.660574 147.793166 \n",
       "L 485.106298 147.522047 \n",
       "L 485.552023 120.228007 \n",
       "L 486.443471 118.083988 \n",
       "L 486.889196 103.754944 \n",
       "L 487.33492 103.82452 \n",
       "L 487.780645 113.694586 \n",
       "L 488.226369 100.617647 \n",
       "L 488.672094 135.099444 \n",
       "L 489.117818 131.976356 \n",
       "L 489.563542 143.68411 \n",
       "L 490.009267 165.762325 \n",
       "L 490.454991 173.553614 \n",
       "L 490.900716 176.591147 \n",
       "L 491.34644 205.420847 \n",
       "L 491.792164 213.107743 \n",
       "L 492.237889 212.262054 \n",
       "L 492.683613 207.109486 \n",
       "L 493.129338 200.086995 \n",
       "L 493.575062 198.216154 \n",
       "L 494.020787 201.987423 \n",
       "L 494.466511 173.657274 \n",
       "L 494.912235 163.370227 \n",
       "L 495.35796 146.836266 \n",
       "L 495.803684 152.916603 \n",
       "L 496.249409 140.120466 \n",
       "L 496.695133 121.262597 \n",
       "L 497.586582 102.134297 \n",
       "L 498.032306 108.239954 \n",
       "L 498.478031 109.58782 \n",
       "L 498.923755 103.31988 \n",
       "L 499.36948 130.514729 \n",
       "L 500.260929 137.079978 \n",
       "L 500.706653 144.665716 \n",
       "L 501.152377 161.14649 \n",
       "L 501.598102 163.119067 \n",
       "L 502.043826 182.817294 \n",
       "L 502.935275 190.554254 \n",
       "L 503.826724 204.310019 \n",
       "L 504.272448 190.151197 \n",
       "L 504.718173 180.098152 \n",
       "L 505.163897 173.104453 \n",
       "L 505.609622 147.837879 \n",
       "L 506.055346 142.262212 \n",
       "L 506.50107 134.975114 \n",
       "L 506.946795 110.396097 \n",
       "L 507.392519 106.269022 \n",
       "L 507.838244 85.718383 \n",
       "L 508.283968 103.508055 \n",
       "L 508.729693 94.275665 \n",
       "L 509.175417 82.713231 \n",
       "L 509.621141 85.624764 \n",
       "L 510.066866 94.704173 \n",
       "L 510.51259 94.231488 \n",
       "L 510.958315 119.517595 \n",
       "L 511.404039 134.411096 \n",
       "L 511.849763 137.14766 \n",
       "L 512.295488 157.631266 \n",
       "L 512.741212 162.181566 \n",
       "L 513.186937 163.013834 \n",
       "L 513.632661 177.893056 \n",
       "L 514.078386 178.195188 \n",
       "L 514.52411 179.054794 \n",
       "L 515.861283 139.090258 \n",
       "L 516.307008 128.260958 \n",
       "L 516.752732 103.855329 \n",
       "L 517.198457 103.32972 \n",
       "L 517.644181 90.228159 \n",
       "L 518.089905 81.952423 \n",
       "L 518.53563 61.523255 \n",
       "L 518.981354 64.90833 \n",
       "L 519.427079 65.653861 \n",
       "L 519.872803 74.864316 \n",
       "L 520.318528 71.200819 \n",
       "L 520.764252 71.993359 \n",
       "L 521.209976 108.509313 \n",
       "L 521.655701 109.992442 \n",
       "L 522.54715 134.504525 \n",
       "L 522.992874 140.379717 \n",
       "L 523.438598 154.063687 \n",
       "L 524.330047 161.739814 \n",
       "L 524.775772 155.092323 \n",
       "L 525.221496 164.792859 \n",
       "L 525.667221 154.624864 \n",
       "L 526.112945 150.13657 \n",
       "L 526.558669 136.03752 \n",
       "L 527.450118 119.20157 \n",
       "L 527.895843 94.046561 \n",
       "L 528.341567 76.3421 \n",
       "L 528.787292 80.796405 \n",
       "L 529.233016 66.016093 \n",
       "L 529.67874 61.221259 \n",
       "L 530.124465 75.545355 \n",
       "L 530.570189 47.606328 \n",
       "L 531.461638 68.105259 \n",
       "L 531.907362 80.962173 \n",
       "L 532.798811 134.028442 \n",
       "L 533.244536 130.302508 \n",
       "L 534.581709 166.084206 \n",
       "L 535.027433 160.943226 \n",
       "L 535.918882 168.925878 \n",
       "L 536.364607 167.530922 \n",
       "L 536.810331 138.737607 \n",
       "L 537.256056 139.009508 \n",
       "L 537.70178 132.176668 \n",
       "L 538.147504 129.610327 \n",
       "L 538.593229 118.469265 \n",
       "L 539.038953 115.633686 \n",
       "L 539.484678 86.837908 \n",
       "L 539.930402 75.356354 \n",
       "L 540.376127 74.61655 \n",
       "L 540.821851 72.591968 \n",
       "L 541.267575 73.657916 \n",
       "L 541.7133 75.597564 \n",
       "L 542.159024 104.554023 \n",
       "L 542.604749 112.56825 \n",
       "L 543.050473 110.319818 \n",
       "L 543.496197 129.415002 \n",
       "L 543.941922 142.223901 \n",
       "L 544.387646 166.923157 \n",
       "L 544.833371 159.734056 \n",
       "L 545.279095 179.07777 \n",
       "L 546.170544 194.665171 \n",
       "L 546.616268 185.316285 \n",
       "L 547.507717 174.957026 \n",
       "L 547.953442 151.6035 \n",
       "L 548.399166 142.715412 \n",
       "L 548.844891 138.718501 \n",
       "L 549.290615 130.089727 \n",
       "L 550.182064 101.30181 \n",
       "L 550.627788 117.244175 \n",
       "L 551.073513 89.863615 \n",
       "L 551.519237 93.042589 \n",
       "L 551.964961 78.257581 \n",
       "L 552.410686 97.153073 \n",
       "L 552.85641 111.026436 \n",
       "L 553.302135 121.172529 \n",
       "L 554.193584 154.598786 \n",
       "L 554.639308 164.097861 \n",
       "L 555.085032 191.822644 \n",
       "L 555.530757 188.068 \n",
       "L 555.976481 209.343208 \n",
       "L 556.422206 207.619971 \n",
       "L 556.86793 209.663311 \n",
       "L 557.759379 185.601013 \n",
       "L 558.205103 178.357275 \n",
       "L 558.650828 181.851781 \n",
       "L 559.988001 137.666606 \n",
       "L 560.433726 118.025479 \n",
       "L 560.87945 110.807235 \n",
       "L 561.325174 107.948515 \n",
       "L 561.770899 88.613078 \n",
       "L 562.216623 94.924012 \n",
       "L 562.662348 90.083379 \n",
       "L 563.108072 109.938307 \n",
       "L 563.553796 113.862362 \n",
       "L 564.445245 140.819087 \n",
       "L 564.89097 163.652549 \n",
       "L 565.336694 167.452207 \n",
       "L 565.782419 192.790961 \n",
       "L 566.228143 189.545648 \n",
       "L 566.673867 187.449131 \n",
       "L 567.565316 204.098417 \n",
       "L 568.011041 206.101985 \n",
       "L 568.456765 192.278824 \n",
       "L 568.90249 196.822106 \n",
       "L 569.793938 173.96798 \n",
       "L 570.239663 147.094115 \n",
       "L 570.685387 145.815349 \n",
       "L 571.131112 118.36436 \n",
       "L 571.576836 103.896366 \n",
       "L 572.022561 97.706366 \n",
       "L 572.468285 98.087282 \n",
       "L 572.914009 92.06401 \n",
       "L 573.359734 105.753075 \n",
       "L 573.805458 100.21233 \n",
       "L 574.251183 97.156561 \n",
       "L 574.696907 109.262729 \n",
       "L 575.142631 144.292755 \n",
       "L 575.588356 145.995558 \n",
       "L 576.03408 160.910088 \n",
       "L 576.479805 163.44286 \n",
       "L 576.925529 178.244886 \n",
       "L 577.816978 196.664033 \n",
       "L 578.262702 191.391342 \n",
       "L 578.708427 190.684199 \n",
       "L 579.599876 174.823988 \n",
       "L 580.0456 170.93467 \n",
       "L 580.491325 144.880812 \n",
       "L 582.274222 84.569159 \n",
       "L 582.719947 76.531741 \n",
       "L 583.165671 66.398804 \n",
       "L 583.611395 71.251237 \n",
       "L 584.05712 71.371624 \n",
       "L 584.502844 82.028513 \n",
       "L 584.948569 98.043429 \n",
       "L 585.394293 109.318014 \n",
       "L 585.840018 108.703007 \n",
       "L 586.285742 124.539082 \n",
       "L 586.731466 134.231566 \n",
       "L 587.177191 167.455658 \n",
       "L 587.622915 161.81981 \n",
       "L 588.06864 166.777459 \n",
       "L 588.514364 174.678923 \n",
       "L 588.960089 174.645276 \n",
       "L 589.405813 183.303023 \n",
       "L 590.297262 144.756642 \n",
       "L 590.742986 150.948506 \n",
       "L 591.188711 124.73476 \n",
       "L 591.634435 119.885671 \n",
       "L 592.525884 76.229854 \n",
       "L 592.971608 75.158233 \n",
       "L 593.417333 64.055609 \n",
       "L 593.863057 56.470344 \n",
       "L 594.308782 59.527634 \n",
       "L 594.754506 51.496003 \n",
       "L 595.20023 81.059919 \n",
       "L 595.645955 76.679644 \n",
       "L 596.091679 99.345984 \n",
       "L 596.537404 108.950426 \n",
       "L 596.983128 111.016732 \n",
       "L 597.428853 133.344653 \n",
       "L 597.874577 139.674 \n",
       "L 598.320301 136.960028 \n",
       "L 598.766026 150.950121 \n",
       "L 599.21175 131.621778 \n",
       "L 599.657475 161.88351 \n",
       "L 600.103199 158.323042 \n",
       "L 600.548924 171.70033 \n",
       "L 600.994648 144.562042 \n",
       "L 601.440372 136.648801 \n",
       "L 601.886097 116.715404 \n",
       "L 602.777546 97.845666 \n",
       "L 603.22327 95.157113 \n",
       "L 603.668994 64.057183 \n",
       "L 604.560443 70.050127 \n",
       "L 605.006168 52.869552 \n",
       "L 605.451892 73.286418 \n",
       "L 605.897617 68.777091 \n",
       "L 606.343341 88.731283 \n",
       "L 606.789065 86.866701 \n",
       "L 607.23479 110.70299 \n",
       "L 607.680514 90.130417 \n",
       "L 608.126239 117.702357 \n",
       "L 608.571963 135.72761 \n",
       "L 609.017688 147.900835 \n",
       "L 609.463412 154.22062 \n",
       "L 609.909136 158.26782 \n",
       "L 610.354861 164.634675 \n",
       "L 610.800585 173.417945 \n",
       "L 611.24631 158.91525 \n",
       "L 611.692034 163.945344 \n",
       "L 612.583483 126.282835 \n",
       "L 613.029207 124.520694 \n",
       "L 613.474932 99.974602 \n",
       "L 613.920656 95.025685 \n",
       "L 614.366381 63.282513 \n",
       "L 614.812105 76.771484 \n",
       "L 615.257829 65.893484 \n",
       "L 615.703554 64.241548 \n",
       "L 616.595003 75.737377 \n",
       "L 617.040727 89.625986 \n",
       "L 617.486452 98.522854 \n",
       "L 617.932176 111.875407 \n",
       "L 618.823625 132.542689 \n",
       "L 619.269349 155.670623 \n",
       "L 619.715074 156.390153 \n",
       "L 620.160798 176.043264 \n",
       "L 620.606523 188.93947 \n",
       "L 621.052247 187.344748 \n",
       "L 621.497971 187.734994 \n",
       "L 622.38942 169.533305 \n",
       "L 622.835145 157.988555 \n",
       "L 623.280869 138.670283 \n",
       "L 623.726593 128.958972 \n",
       "L 624.172318 124.951036 \n",
       "L 624.618042 105.676256 \n",
       "L 625.063767 100.363014 \n",
       "L 625.509491 86.581574 \n",
       "L 625.955216 78.795231 \n",
       "L 626.40094 88.265362 \n",
       "L 626.846664 84.425963 \n",
       "L 627.292389 86.090785 \n",
       "L 627.738113 103.01181 \n",
       "L 628.183838 125.899585 \n",
       "L 628.629562 131.989556 \n",
       "L 629.075287 152.267508 \n",
       "L 629.521011 152.208363 \n",
       "L 629.966735 171.420087 \n",
       "L 630.41246 181.830274 \n",
       "L 630.858184 179.501056 \n",
       "L 631.303909 192.743652 \n",
       "L 631.749633 199.295821 \n",
       "L 632.195358 212.337464 \n",
       "L 632.641082 197.468324 \n",
       "L 633.086806 190.475563 \n",
       "L 633.532531 175.892412 \n",
       "L 633.978255 171.298023 \n",
       "L 634.42398 143.757503 \n",
       "L 634.869704 125.641378 \n",
       "L 635.315428 125.402028 \n",
       "L 635.761153 123.222503 \n",
       "L 636.206877 103.39843 \n",
       "L 636.652602 101.162044 \n",
       "L 637.098326 90.494136 \n",
       "L 637.989775 111.498379 \n",
       "L 638.435499 125.045677 \n",
       "L 638.881224 125.650781 \n",
       "L 639.326948 156.24131 \n",
       "L 639.772673 160.596316 \n",
       "L 640.218397 160.381002 \n",
       "L 640.664122 179.493599 \n",
       "L 641.55557 198.670865 \n",
       "L 642.001295 212.105689 \n",
       "L 642.447019 205.791635 \n",
       "L 642.892744 196.968531 \n",
       "L 643.338468 190.62072 \n",
       "L 643.784193 193.37734 \n",
       "L 644.675641 153.723474 \n",
       "L 645.121366 144.615803 \n",
       "L 645.56709 120.956399 \n",
       "L 646.012815 119.185349 \n",
       "L 646.458539 120.363133 \n",
       "L 646.904263 99.394251 \n",
       "L 647.795712 86.620081 \n",
       "L 648.241437 89.39459 \n",
       "L 648.687161 86.681307 \n",
       "L 650.470059 143.600193 \n",
       "L 650.915783 144.898028 \n",
       "L 651.361508 152.277827 \n",
       "L 651.807232 173.941306 \n",
       "L 652.698681 189.650126 \n",
       "L 653.144405 187.012543 \n",
       "L 653.59013 185.445831 \n",
       "L 654.035854 183.182271 \n",
       "L 654.481579 163.158879 \n",
       "L 654.927303 166.214832 \n",
       "L 655.373027 143.090652 \n",
       "L 656.264476 110.140519 \n",
       "L 657.155925 97.138886 \n",
       "L 657.60165 81.685636 \n",
       "L 658.047374 82.839647 \n",
       "L 658.493098 75.430639 \n",
       "L 658.938823 79.771931 \n",
       "L 659.384547 60.487404 \n",
       "L 659.830272 102.901908 \n",
       "L 660.275996 105.928264 \n",
       "L 660.721721 99.649753 \n",
       "L 661.613169 144.993525 \n",
       "L 662.058894 141.752451 \n",
       "L 662.504618 140.558973 \n",
       "L 662.950343 163.517236 \n",
       "L 663.396067 161.3889 \n",
       "L 663.841792 178.779843 \n",
       "L 664.287516 170.195745 \n",
       "L 665.178965 148.740457 \n",
       "L 665.624689 143.326165 \n",
       "L 667.407587 86.898584 \n",
       "L 667.853311 75.7043 \n",
       "L 668.299036 59.313594 \n",
       "L 668.74476 67.86933 \n",
       "L 669.190485 51.461924 \n",
       "L 669.636209 43.65634 \n",
       "L 670.527658 73.716812 \n",
       "L 670.973382 87.968362 \n",
       "L 671.419107 97.351714 \n",
       "L 671.864831 115.94857 \n",
       "L 672.310556 118.29829 \n",
       "L 672.75628 133.298735 \n",
       "L 673.202004 137.309217 \n",
       "L 673.647729 148.901701 \n",
       "L 674.093453 149.670906 \n",
       "L 674.539178 145.614488 \n",
       "L 674.984902 147.373685 \n",
       "L 675.430626 128.152375 \n",
       "L 675.876351 131.475633 \n",
       "L 676.322075 132.281183 \n",
       "L 676.7678 111.273171 \n",
       "L 677.213524 96.37373 \n",
       "L 677.659249 87.632353 \n",
       "L 678.104973 70.292523 \n",
       "L 678.550697 60.856537 \n",
       "L 678.996422 47.141499 \n",
       "L 679.887871 58.12633 \n",
       "L 680.333595 56.724655 \n",
       "L 681.225044 88.449526 \n",
       "L 681.670768 87.854627 \n",
       "L 682.116493 97.251445 \n",
       "L 682.562217 112.718935 \n",
       "L 683.007942 112.627945 \n",
       "L 683.453666 142.92222 \n",
       "L 683.899391 155.119177 \n",
       "L 684.345115 139.602628 \n",
       "L 684.790839 171.685967 \n",
       "L 685.236564 156.310766 \n",
       "L 685.682288 161.356253 \n",
       "L 686.128013 174.848351 \n",
       "L 686.573737 140.043069 \n",
       "L 687.019461 139.43106 \n",
       "L 687.465186 121.829383 \n",
       "L 688.356635 96.074013 \n",
       "L 689.248084 60.177616 \n",
       "L 689.693808 67.169957 \n",
       "L 690.139532 66.394936 \n",
       "L 690.585257 57.402867 \n",
       "L 691.030981 63.600451 \n",
       "L 691.476706 92.636097 \n",
       "L 691.92243 79.579725 \n",
       "L 692.368155 97.918473 \n",
       "L 692.813879 110.460153 \n",
       "L 693.259603 134.167639 \n",
       "L 693.705328 123.310343 \n",
       "L 694.596777 166.173601 \n",
       "L 695.042501 174.936606 \n",
       "L 695.488225 178.983712 \n",
       "L 695.93395 180.69515 \n",
       "L 696.379674 172.625391 \n",
       "L 696.825399 170.876106 \n",
       "L 697.271123 169.820849 \n",
       "L 697.716848 157.448105 \n",
       "L 698.162572 138.93275 \n",
       "L 698.608296 137.9669 \n",
       "L 699.054021 120.822077 \n",
       "L 699.499745 98.587954 \n",
       "L 699.94547 95.814587 \n",
       "L 700.391194 77.516103 \n",
       "L 700.836919 92.736519 \n",
       "L 701.282643 86.748381 \n",
       "L 702.174092 98.930523 \n",
       "L 702.619816 95.969059 \n",
       "L 703.065541 105.464684 \n",
       "L 703.95699 142.133794 \n",
       "L 704.402714 141.987025 \n",
       "L 704.848438 156.465036 \n",
       "L 705.294163 195.506463 \n",
       "L 705.739887 189.189892 \n",
       "L 706.185612 209.359534 \n",
       "L 706.631336 207.665374 \n",
       "L 707.07706 199.317229 \n",
       "L 707.522785 197.850092 \n",
       "L 707.968509 176.357159 \n",
       "L 708.414234 173.253193 \n",
       "L 709.305683 144.718932 \n",
       "L 709.751407 117.549676 \n",
       "L 710.197131 115.985247 \n",
       "L 710.642856 100.819458 \n",
       "L 711.08858 95.797059 \n",
       "L 711.534305 85.745866 \n",
       "L 711.980029 93.187802 \n",
       "L 712.425754 96.227975 \n",
       "L 712.871478 91.730343 \n",
       "L 713.317202 108.835195 \n",
       "L 713.762927 133.330146 \n",
       "L 714.208651 143.645403 \n",
       "L 715.1001 157.59072 \n",
       "L 715.545824 179.689943 \n",
       "L 715.991549 173.134979 \n",
       "L 716.437273 189.231909 \n",
       "L 717.328722 207.60193 \n",
       "L 717.774447 190.672337 \n",
       "L 718.220171 185.425226 \n",
       "L 718.665895 189.839161 \n",
       "L 719.11162 159.587528 \n",
       "L 719.557344 147.04983 \n",
       "L 720.003069 130.976496 \n",
       "L 720.448793 128.245791 \n",
       "L 720.894518 107.864528 \n",
       "L 721.340242 119.116684 \n",
       "L 721.785966 91.828655 \n",
       "L 722.231691 92.594888 \n",
       "L 722.677415 88.146034 \n",
       "L 723.12314 85.550128 \n",
       "L 723.568864 99.237219 \n",
       "L 724.014589 103.373056 \n",
       "L 724.460313 119.951257 \n",
       "L 724.906037 130.667643 \n",
       "L 725.351762 146.216958 \n",
       "L 725.797486 148.064059 \n",
       "L 726.243211 153.094503 \n",
       "L 726.688935 179.878248 \n",
       "L 727.134659 192.007599 \n",
       "L 727.580384 185.816651 \n",
       "L 728.026108 181.87953 \n",
       "L 728.471833 180.030375 \n",
       "L 728.917557 184.366906 \n",
       "L 729.363282 166.065126 \n",
       "L 729.809006 160.456302 \n",
       "L 730.700455 126.771666 \n",
       "L 731.146179 114.51997 \n",
       "L 731.591904 94.338438 \n",
       "L 732.037628 89.97282 \n",
       "L 732.483353 65.760509 \n",
       "L 732.929077 70.393725 \n",
       "L 733.374801 77.413775 \n",
       "L 733.820526 62.812811 \n",
       "L 734.26625 68.465936 \n",
       "L 735.603424 102.507083 \n",
       "L 736.049148 111.531966 \n",
       "L 736.494872 131.725654 \n",
       "L 736.940597 136.39197 \n",
       "L 737.386321 156.827443 \n",
       "L 737.832046 156.169463 \n",
       "L 738.27777 171.57899 \n",
       "L 738.723494 162.220975 \n",
       "L 739.169219 157.656987 \n",
       "L 739.614943 159.665746 \n",
       "L 740.060668 143.515229 \n",
       "L 740.506392 148.318658 \n",
       "L 740.952117 121.55804 \n",
       "L 741.397841 108.382424 \n",
       "L 741.843565 87.454821 \n",
       "L 742.28929 79.183143 \n",
       "L 743.180739 44.569 \n",
       "L 743.626463 52.51978 \n",
       "L 744.072188 44.695806 \n",
       "L 744.517912 40.376477 \n",
       "L 744.963636 50.87335 \n",
       "L 745.409361 58.030168 \n",
       "L 745.409361 58.030168 \n",
       "\" clip-path=\"url(#p47d81de12c)\" style=\"fill: none; stroke: #0969da; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 43.861406 259.8575 \n",
       "L 43.861406 29.925 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 43.861406 259.8575 \n",
       "L 778.816406 259.8575 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_17\">\n",
       "    <text style=\"font-weight: 600; font-size: 11px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #171817\" x=\"43.861406\" y=\"17.925\" transform=\"rotate(-0 43.861406 17.925)\">Synthetic workload and three predeclared future blocks</text>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p47d81de12c\">\n",
       "   <rect x=\"43.861406\" y=\"29.925\" width=\"734.955\" height=\"229.9325\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1100x400 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>timestamp</th>\n",
       "      <th>orders_per_hour</th>\n",
       "      <th>activity_index</th>\n",
       "      <th>upstream_volume</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2026-01-01 00:00:00</td>\n",
       "      <td>100.789127</td>\n",
       "      <td>50.065803</td>\n",
       "      <td>186.679219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2026-01-01 01:00:00</td>\n",
       "      <td>106.267287</td>\n",
       "      <td>53.579933</td>\n",
       "      <td>188.706129</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2026-01-01 02:00:00</td>\n",
       "      <td>112.419190</td>\n",
       "      <td>55.310237</td>\n",
       "      <td>207.775588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2026-01-01 03:00:00</td>\n",
       "      <td>110.567909</td>\n",
       "      <td>60.236967</td>\n",
       "      <td>208.237108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2026-01-01 04:00:00</td>\n",
       "      <td>128.208235</td>\n",
       "      <td>62.641313</td>\n",
       "      <td>217.712561</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            timestamp  orders_per_hour  activity_index  upstream_volume\n",
       "0 2026-01-01 00:00:00       100.789127       50.065803       186.679219\n",
       "1 2026-01-01 01:00:00       106.267287       53.579933       188.706129\n",
       "2 2026-01-01 02:00:00       112.419190       55.310237       207.775588\n",
       "3 2026-01-01 03:00:00       110.567909       60.236967       208.237108\n",
       "4 2026-01-01 04:00:00       128.208235       62.641313       217.712561"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ]
  },
  {
   "id": "cell-04",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## Draw the information boundary\n",
    "\n",
    "At each origin, the model receives only the preceding 512 observations. DARR's retrieval library ends **before that input window starts**, so its historical continuations cannot contain held-out future values. The supplied checkpoint and standardizer are frozen; we do not fit them on this fixture. Past auxiliary channels are available, but future auxiliary values are never provided.\n",
    "\n",
    "The model's native head is 72 points. We keep sequence length 512 and horizon 72, use three forecast origins, and fix DARR at 20% direct forecast / 80% historical retrieval before looking at errors.[2] This is a small demonstration, not hyperparameter optimization. Sequential forecast blocks emulate later decision times: once a block becomes history it is legitimately observable at the next origin.\n"
   ]
  },
  {
   "id": "cell-05",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 3,
   "source": [
    "config = ForecastingConfig(\n",
    "    target_column=TARGET, seq_len=512, forecast_horizon=HORIZON, model_horizon=72,\n",
    "    ckpt=str(weights/'run8_best_model_cr.pt'),\n",
    "    standardizer_pkl=str(weights/'standardizer.pkl'),\n",
    "    model_name=str(RUNTIME/'backbone'), local_files_only=True,\n",
    "    device=DEVICE, num_workers=0, batch_size=4, use_cross_channel=True,\n",
    "    alpha=.2, k=4, context_stride=72, seed=42,\n",
    ")\n",
    "rows, timings = [], []\n",
    "for origin in origins:\n",
    "    history = df.iloc[origin-512:origin].copy()\n",
    "    context = df.iloc[:origin-512].copy()\n",
    "    future = df.iloc[origin:origin+HORIZON].copy()\n",
    "    assert context.timestamp.max() < history.timestamp.min() < future.timestamp.min()\n",
    "    assert history.timestamp.max() < future.timestamp.min()\n",
    "    started = time.perf_counter()\n",
    "    direct = perform_forecasting(df=history, config=config)\n",
    "    darr = perform_forecasting(df=history, config=config, context_df=context)\n",
    "    timings.append(time.perf_counter()-started)\n",
    "    assert direct.timestamp.tolist() == future.timestamp.tolist()\n",
    "    assert darr.timestamp.tolist() == future.timestamp.tolist()\n",
    "    predictions = {\n",
    "        'Persistence': np.repeat(history[TARGET].iloc[-1], HORIZON),\n",
    "        'Daily seasonal': np.tile(history[TARGET].iloc[-24:].to_numpy(), 3),\n",
    "        'NV-Tesseract direct': direct[f'{TARGET}_forecast'].to_numpy(),\n",
    "        'NV-Tesseract DARR': darr[f'{TARGET}_forecast'].to_numpy(),\n",
    "    }\n",
    "    for method, prediction in predictions.items():\n",
    "        assert len(prediction) == HORIZON and np.isfinite(prediction).all()\n",
    "        rows.extend({'origin': origin, 'timestamp': timestamp, 'method': method,\n",
    "                     'actual': float(actual), 'prediction': float(predicted)}\n",
    "                    for timestamp,actual,predicted in zip(future.timestamp, future[TARGET], prediction))\n",
    "results = pd.DataFrame(rows)\n",
    "print(f'Executed {len(origins)} origins, two model modes per origin, on {DEVICE}.')\n",
    "print('Seconds per origin (includes cold loading at the first origin):', np.round(timings,2).tolist())\n"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading weights from local directory\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "UserWarning: Only reconstruction head is pre-trained; others need fine-tuning.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Executed 3 origins, two model modes per origin, on mps.\n",
      "Seconds per origin (includes cold loading at the first origin): [6.72, 0.24, 0.27]\n"
     ]
    }
   ]
  },
  {
   "id": "cell-06",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## Read the forecast, not just a headline score\n",
    "\n",
    "MAE averages absolute errors; WAPE divides total absolute error by total actual volume. Report all origins, not the prettiest one. No claim about model superiority is required for this notebook to succeed: an honest baseline win is useful evidence.\n"
   ]
  },
  {
   "id": "cell-07",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 4,
   "source": [
    "results['absolute_error'] = (results.prediction-results.actual).abs()\n",
    "metrics = results.groupby('method').apply(lambda group: pd.Series({\n",
    "    'MAE': group.absolute_error.mean(),\n",
    "    'WAPE_pct': 100*group.absolute_error.sum()/group.actual.abs().sum(),\n",
    "}), include_groups=False).sort_values('MAE')\n",
    "display(metrics.round(3))\n",
    "display(results.groupby(['origin','method']).absolute_error.mean().unstack().round(2))\n",
    "first = results[results.origin == origins[0]]\n",
    "fig, ax = plt.subplots(figsize=(11,5))\n",
    "actual = first[first.method=='Persistence']\n",
    "ax.plot(actual.timestamp, actual.actual, color='#171817', linewidth=2, label='Actual future (evaluation only)')\n",
    "for method in ['Daily seasonal', 'NV-Tesseract direct', 'NV-Tesseract DARR']:\n",
    "    subset = first[first.method==method]\n",
    "    ax.plot(subset.timestamp, subset.prediction, label=method)\n",
    "ax.set(title='First forecast block — every method faces the same unseen future', ylabel=TARGET.replace('_',' '))\n",
    "ax.legend(fontsize=9); plt.tight_layout(); plt.show()\n"
   ],
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>MAE</th>\n",
       "      <th>WAPE_pct</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>NV-Tesseract direct</th>\n",
       "      <td>8.357</td>\n",
       "      <td>7.145</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NV-Tesseract DARR</th>\n",
       "      <td>8.579</td>\n",
       "      <td>7.334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Daily seasonal</th>\n",
       "      <td>13.585</td>\n",
       "      <td>11.614</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Persistence</th>\n",
       "      <td>28.470</td>\n",
       "      <td>24.339</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        MAE  WAPE_pct\n",
       "method                               \n",
       "NV-Tesseract direct   8.357     7.145\n",
       "NV-Tesseract DARR     8.579     7.334\n",
       "Daily seasonal       13.585    11.614\n",
       "Persistence          28.470    24.339"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>method</th>\n",
       "      <th>Daily seasonal</th>\n",
       "      <th>NV-Tesseract DARR</th>\n",
       "      <th>NV-Tesseract direct</th>\n",
       "      <th>Persistence</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>origin</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1280</th>\n",
       "      <td>17.40</td>\n",
       "      <td>11.68</td>\n",
       "      <td>9.01</td>\n",
       "      <td>20.31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1352</th>\n",
       "      <td>13.76</td>\n",
       "      <td>7.81</td>\n",
       "      <td>8.36</td>\n",
       "      <td>38.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1424</th>\n",
       "      <td>9.59</td>\n",
       "      <td>6.24</td>\n",
       "      <td>7.70</td>\n",
       "      <td>26.23</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "method  Daily seasonal  NV-Tesseract DARR  NV-Tesseract direct  Persistence\n",
       "origin                                                                     \n",
       "1280             17.40              11.68                 9.01        20.31\n",
       "1352             13.76               7.81                 8.36        38.88\n",
       "1424              9.59               6.24                 7.70        26.23"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"786.016406pt\" height=\"354.96pt\" viewBox=\"0 0 786.016406 354.96\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2026-10-06T14:15:37.686892</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.11.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 354.96 \n",
       "L 786.016406 354.96 \n",
       "L 786.016406 0 \n",
       "L 0 0 \n",
       "L 0 354.96 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 43.861406 331.8575 \n",
       "L 778.816406 331.8575 \n",
       "L 778.816406 29.925 \n",
       "L 43.861406 29.925 \n",
       "L 43.861406 331.8575 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"114.910193\" y=\"345.9495\" transform=\"rotate(-0 114.910193 345.9495)\">02-23 12</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"227.835417\" y=\"345.9495\" transform=\"rotate(-0 227.835417 345.9495)\">02-24 00</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"340.760641\" y=\"345.9495\" transform=\"rotate(-0 340.760641 345.9495)\">02-24 12</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"453.685865\" y=\"345.9495\" transform=\"rotate(-0 453.685865 345.9495)\">02-25 00</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"566.611089\" y=\"345.9495\" transform=\"rotate(-0 566.611089 345.9495)\">02-25 12</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_6\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"679.536313\" y=\"345.9495\" transform=\"rotate(-0 679.536313 345.9495)\">02-26 00</text>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 43.861406 289.883057 \n",
       "L 778.816406 289.883057 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"293.929057\" transform=\"rotate(-0 37.861406 293.929057)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 43.861406 228.272628 \n",
       "L 778.816406 228.272628 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"232.318628\" transform=\"rotate(-0 37.861406 232.318628)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 43.861406 166.662199 \n",
       "L 778.816406 166.662199 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"170.708199\" transform=\"rotate(-0 37.861406 170.708199)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 43.861406 105.05177 \n",
       "L 778.816406 105.05177 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"109.09777\" transform=\"rotate(-0 37.861406 109.09777)\">140</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 43.861406 43.44134 \n",
       "L 778.816406 43.44134 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\"/>\n",
       "     <g id=\"text_11\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"37.861406\" y=\"47.48734\" transform=\"rotate(-0 37.861406 47.48734)\">160</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_12\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #484945\" x=\"15.768\" y=\"180.89125\" transform=\"rotate(-90 15.768 180.89125)\">orders per hour</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_17\">\n",
       "    <path d=\"M 77.268452 113.657569 \n",
       "L 86.678887 118.178563 \n",
       "L 96.089322 113.757335 \n",
       "L 105.499758 138.050041 \n",
       "L 114.910193 160.133563 \n",
       "L 124.320628 188.805762 \n",
       "L 133.731064 206.505267 \n",
       "L 143.141499 208.620057 \n",
       "L 152.551934 220.645259 \n",
       "L 161.96237 255.945368 \n",
       "L 171.372805 269.850882 \n",
       "L 180.78324 281.542505 \n",
       "L 190.193676 277.244628 \n",
       "L 199.604111 274.69171 \n",
       "L 209.014546 271.003293 \n",
       "L 218.424982 238.375667 \n",
       "L 227.835417 243.355267 \n",
       "L 237.245852 205.674981 \n",
       "L 246.656288 181.682887 \n",
       "L 256.066723 151.983546 \n",
       "L 265.477158 139.985189 \n",
       "L 274.887594 130.797704 \n",
       "L 284.298029 105.617011 \n",
       "L 293.708465 107.497444 \n",
       "L 303.1189 95.424646 \n",
       "L 312.529335 102.498675 \n",
       "L 321.939771 71.07501 \n",
       "L 331.350206 140.188407 \n",
       "L 340.760641 145.119779 \n",
       "L 350.171077 134.8891 \n",
       "L 359.581512 173.549253 \n",
       "L 368.991947 208.775667 \n",
       "L 378.402383 203.494416 \n",
       "L 387.812818 201.549673 \n",
       "L 397.223253 238.9596 \n",
       "L 406.633689 235.49153 \n",
       "L 416.044124 263.829645 \n",
       "L 425.454559 249.842068 \n",
       "L 434.864995 229.901064 \n",
       "L 444.27543 214.881201 \n",
       "L 453.685865 206.058745 \n",
       "L 463.096301 182.842911 \n",
       "L 472.506736 159.824764 \n",
       "L 481.917171 138.603349 \n",
       "L 491.327607 114.111383 \n",
       "L 500.738042 95.87057 \n",
       "L 510.148477 69.162316 \n",
       "L 519.558913 83.103678 \n",
       "L 528.969348 56.368212 \n",
       "L 538.379783 43.649205 \n",
       "L 547.790219 71.465119 \n",
       "L 557.200654 92.632007 \n",
       "L 566.611089 115.854559 \n",
       "L 576.021525 131.144502 \n",
       "L 585.43196 161.447623 \n",
       "L 594.842395 165.276435 \n",
       "L 604.252831 189.719293 \n",
       "L 613.663266 196.254276 \n",
       "L 623.073701 215.143945 \n",
       "L 632.484137 216.397345 \n",
       "L 641.894572 209.787511 \n",
       "L 651.305007 212.654079 \n",
       "L 660.715443 181.333426 \n",
       "L 670.125878 186.748593 \n",
       "L 679.536313 188.061217 \n",
       "L 688.946749 153.829175 \n",
       "L 698.357184 129.5509 \n",
       "L 707.767619 115.307042 \n",
       "L 717.178055 87.052213 \n",
       "L 726.58849 71.676505 \n",
       "L 735.998925 49.328185 \n",
       "L 745.409361 59.274353 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #171817; stroke-width: 2; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_18\">\n",
       "    <path d=\"M 77.268452 119.970247 \n",
       "L 86.678887 136.564721 \n",
       "L 96.089322 154.196146 \n",
       "L 105.499758 176.271136 \n",
       "L 114.910193 177.25714 \n",
       "L 124.320628 227.103658 \n",
       "L 133.731064 234.200034 \n",
       "L 143.141499 233.849183 \n",
       "L 152.551934 264.992693 \n",
       "L 161.96237 280.898452 \n",
       "L 171.372805 296.241579 \n",
       "L 180.78324 318.133295 \n",
       "L 190.193676 307.844699 \n",
       "L 199.604111 293.467667 \n",
       "L 209.014546 283.124065 \n",
       "L 218.424982 287.61591 \n",
       "L 227.835417 255.063503 \n",
       "L 237.245852 223.000904 \n",
       "L 246.656288 208.160178 \n",
       "L 256.066723 169.607758 \n",
       "L 265.477158 166.721875 \n",
       "L 274.887594 168.641046 \n",
       "L 284.298029 134.472765 \n",
       "L 293.708465 123.340792 \n",
       "L 303.1189 119.970247 \n",
       "L 312.529335 136.564721 \n",
       "L 321.939771 154.196146 \n",
       "L 331.350206 176.271136 \n",
       "L 340.760641 177.25714 \n",
       "L 350.171077 227.103658 \n",
       "L 359.581512 234.200034 \n",
       "L 368.991947 233.849183 \n",
       "L 378.402383 264.992693 \n",
       "L 387.812818 280.898452 \n",
       "L 397.223253 296.241579 \n",
       "L 406.633689 318.133295 \n",
       "L 416.044124 307.844699 \n",
       "L 425.454559 293.467667 \n",
       "L 434.864995 283.124065 \n",
       "L 444.27543 287.61591 \n",
       "L 453.685865 255.063503 \n",
       "L 463.096301 223.000904 \n",
       "L 472.506736 208.160178 \n",
       "L 481.917171 169.607758 \n",
       "L 491.327607 166.721875 \n",
       "L 500.738042 168.641046 \n",
       "L 510.148477 134.472765 \n",
       "L 519.558913 123.340792 \n",
       "L 528.969348 119.970247 \n",
       "L 538.379783 136.564721 \n",
       "L 547.790219 154.196146 \n",
       "L 557.200654 176.271136 \n",
       "L 566.611089 177.25714 \n",
       "L 576.021525 227.103658 \n",
       "L 585.43196 234.200034 \n",
       "L 594.842395 233.849183 \n",
       "L 604.252831 264.992693 \n",
       "L 613.663266 280.898452 \n",
       "L 623.073701 296.241579 \n",
       "L 632.484137 318.133295 \n",
       "L 641.894572 307.844699 \n",
       "L 651.305007 293.467667 \n",
       "L 660.715443 283.124065 \n",
       "L 670.125878 287.61591 \n",
       "L 679.536313 255.063503 \n",
       "L 688.946749 223.000904 \n",
       "L 698.357184 208.160178 \n",
       "L 707.767619 169.607758 \n",
       "L 717.178055 166.721875 \n",
       "L 726.58849 168.641046 \n",
       "L 735.998925 134.472765 \n",
       "L 745.409361 123.340792 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #0969da; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_19\">\n",
       "    <path d=\"M 77.268452 141.025986 \n",
       "L 86.678887 139.70176 \n",
       "L 96.089322 145.611373 \n",
       "L 105.499758 159.9174 \n",
       "L 114.910193 178.708953 \n",
       "L 124.320628 194.741098 \n",
       "L 133.731064 201.996606 \n",
       "L 143.141499 210.105373 \n",
       "L 152.551934 216.675924 \n",
       "L 161.96237 224.207798 \n",
       "L 171.372805 233.283223 \n",
       "L 180.78324 243.865888 \n",
       "L 190.193676 244.833157 \n",
       "L 199.604111 246.62097 \n",
       "L 209.014546 247.042159 \n",
       "L 218.424982 228.511108 \n",
       "L 227.835417 224.359178 \n",
       "L 237.245852 211.197276 \n",
       "L 246.656288 196.209559 \n",
       "L 256.066723 182.146054 \n",
       "L 265.477158 162.03674 \n",
       "L 274.887594 136.91032 \n",
       "L 284.298029 117.126609 \n",
       "L 293.708465 114.988162 \n",
       "L 303.1189 125.055323 \n",
       "L 312.529335 120.642679 \n",
       "L 321.939771 127.25685 \n",
       "L 331.350206 145.397407 \n",
       "L 340.760641 155.894992 \n",
       "L 350.171077 176.487942 \n",
       "L 359.581512 193.54945 \n",
       "L 368.991947 196.339716 \n",
       "L 378.402383 213.106691 \n",
       "L 387.812818 215.704024 \n",
       "L 397.223253 234.125107 \n",
       "L 406.633689 245.422389 \n",
       "L 416.044124 252.897175 \n",
       "L 425.454559 241.190127 \n",
       "L 434.864995 239.339092 \n",
       "L 444.27543 224.170758 \n",
       "L 453.685865 215.491585 \n",
       "L 463.096301 202.93753 \n",
       "L 472.506736 184.683433 \n",
       "L 481.917171 172.64239 \n",
       "L 491.327607 148.838692 \n",
       "L 500.738042 120.089571 \n",
       "L 510.148477 105.971799 \n",
       "L 519.558913 104.623883 \n",
       "L 528.969348 118.990875 \n",
       "L 538.379783 124.250362 \n",
       "L 547.790219 127.963806 \n",
       "L 557.200654 143.540426 \n",
       "L 566.611089 154.051173 \n",
       "L 576.021525 175.15133 \n",
       "L 585.43196 185.730705 \n",
       "L 594.842395 190.982482 \n",
       "L 604.252831 203.341961 \n",
       "L 613.663266 214.993426 \n",
       "L 623.073701 226.770535 \n",
       "L 632.484137 244.886555 \n",
       "L 641.894572 249.594179 \n",
       "L 651.305007 242.454844 \n",
       "L 660.715443 240.78492 \n",
       "L 670.125878 237.113616 \n",
       "L 679.536313 216.436128 \n",
       "L 688.946749 202.465552 \n",
       "L 698.357184 192.655532 \n",
       "L 707.767619 174.001305 \n",
       "L 717.178055 156.003574 \n",
       "L 726.58849 131.047571 \n",
       "L 735.998925 105.329005 \n",
       "L 745.409361 109.221915 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #1a7f64; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_20\">\n",
       "    <path d=\"M 77.268452 117.68061 \n",
       "L 86.678887 116.831041 \n",
       "L 96.089322 131.975074 \n",
       "L 105.499758 137.816906 \n",
       "L 114.910193 150.685613 \n",
       "L 124.320628 179.64816 \n",
       "L 133.731064 204.337833 \n",
       "L 143.141499 225.901365 \n",
       "L 152.551934 232.977479 \n",
       "L 161.96237 248.274889 \n",
       "L 171.372805 270.300293 \n",
       "L 180.78324 268.660875 \n",
       "L 190.193676 274.126784 \n",
       "L 199.604111 267.631112 \n",
       "L 209.014546 266.110594 \n",
       "L 218.424982 260.438991 \n",
       "L 227.835417 236.743146 \n",
       "L 237.245852 226.214677 \n",
       "L 246.656288 203.596305 \n",
       "L 256.066723 174.828852 \n",
       "L 265.477158 161.412442 \n",
       "L 274.887594 127.68046 \n",
       "L 284.298029 111.447321 \n",
       "L 293.708465 115.71862 \n",
       "L 303.1189 119.277888 \n",
       "L 312.529335 109.9802 \n",
       "L 321.939771 129.078107 \n",
       "L 331.350206 137.933525 \n",
       "L 340.760641 166.871371 \n",
       "L 350.171077 180.886766 \n",
       "L 359.581512 207.049083 \n",
       "L 368.991947 218.134819 \n",
       "L 378.402383 249.101848 \n",
       "L 387.812818 262.40641 \n",
       "L 397.223253 265.941987 \n",
       "L 406.633689 277.112708 \n",
       "L 416.044124 275.660817 \n",
       "L 425.454559 263.815385 \n",
       "L 434.864995 262.060406 \n",
       "L 444.27543 249.144106 \n",
       "L 453.685865 234.639624 \n",
       "L 463.096301 217.313124 \n",
       "L 472.506736 193.737424 \n",
       "L 481.917171 169.799338 \n",
       "L 491.327607 160.018955 \n",
       "L 500.738042 133.493571 \n",
       "L 510.148477 124.160018 \n",
       "L 519.558913 118.95581 \n",
       "L 528.969348 118.651875 \n",
       "L 538.379783 123.361262 \n",
       "L 547.790219 134.818361 \n",
       "L 557.200654 141.776421 \n",
       "L 566.611089 169.275984 \n",
       "L 576.021525 192.065878 \n",
       "L 585.43196 201.639133 \n",
       "L 594.842395 221.841494 \n",
       "L 604.252831 232.638761 \n",
       "L 613.663266 261.417377 \n",
       "L 623.073701 277.133531 \n",
       "L 632.484137 292.883341 \n",
       "L 641.894572 285.512929 \n",
       "L 651.305007 284.026372 \n",
       "L 660.715443 266.148597 \n",
       "L 670.125878 260.022996 \n",
       "L 679.536313 237.001908 \n",
       "L 688.946749 236.210438 \n",
       "L 698.357184 205.673974 \n",
       "L 707.767619 176.862078 \n",
       "L 717.178055 165.990003 \n",
       "L 726.58849 147.38539 \n",
       "L 735.998925 123.699228 \n",
       "L 745.409361 119.768621 \n",
       "\" clip-path=\"url(#p005f52d631)\" style=\"fill: none; stroke: #b35900; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 43.861406 331.8575 \n",
       "L 43.861406 29.925 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 43.861406 331.8575 \n",
       "L 778.816406 331.8575 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_13\">\n",
       "    <text style=\"font-weight: 600; font-size: 11px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #171817\" x=\"43.861406\" y=\"17.925\" transform=\"rotate(-0 43.861406 17.925)\">First forecast block — every method faces the same unseen future</text>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"line2d_21\">\n",
       "     <path d=\"M 51.961406 43.443 \n",
       "L 60.961406 43.443 \n",
       "L 69.961406 43.443 \n",
       "\" style=\"fill: none; stroke: #171817; stroke-width: 2; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"77.161406\" y=\"46.593\" transform=\"rotate(-0 77.161406 46.593)\">Actual future (evaluation only)</text>\n",
       "    </g>\n",
       "    <g id=\"line2d_22\">\n",
       "     <path d=\"M 51.961406 58.428 \n",
       "L 60.961406 58.428 \n",
       "L 69.961406 58.428 \n",
       "\" style=\"fill: none; stroke: #0969da; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_15\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"77.161406\" y=\"61.578\" transform=\"rotate(-0 77.161406 61.578)\">Daily seasonal</text>\n",
       "    </g>\n",
       "    <g id=\"line2d_23\">\n",
       "     <path d=\"M 51.961406 73.413 \n",
       "L 60.961406 73.413 \n",
       "L 69.961406 73.413 \n",
       "\" style=\"fill: none; stroke: #1a7f64; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_16\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"77.161406\" y=\"76.563\" transform=\"rotate(-0 77.161406 76.563)\">NV-Tesseract direct</text>\n",
       "    </g>\n",
       "    <g id=\"line2d_24\">\n",
       "     <path d=\"M 51.961406 88.398 \n",
       "L 60.961406 88.398 \n",
       "L 69.961406 88.398 \n",
       "\" style=\"fill: none; stroke: #b35900; stroke-width: 1.8; stroke-linecap: round\"/>\n",
       "    </g>\n",
       "    <g id=\"text_17\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"77.161406\" y=\"91.548\" transform=\"rotate(-0 77.161406 91.548)\">NV-Tesseract DARR</text>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p005f52d631\">\n",
       "   <rect x=\"43.861406\" y=\"29.925\" width=\"734.955\" height=\"301.9325\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1100x500 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ]
  },
  {
   "id": "cell-08",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## Turn error into an operating decision\n",
    "\n",
    "The business decision is units of inventory, not a low error score. For illustration, count each unit of underprediction as four cost units and overprediction as one. These are **assumptions**, not measured dollars, service-level guarantees, or an inventory/queueing optimization. We clip negative predictions to zero only for this nonnegative capacity decision, not to improve the reported forecast MAE.\n",
    "\n",
    "Compare a declared 10% planning buffer with no buffer. This teaches the separation between a statistical forecast and a decision policy. Do not select a buffer on these test results and then describe its savings as out-of-sample.\n"
   ]
  },
  {
   "id": "cell-09",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 5,
   "source": [
    "policies = []\n",
    "for buffer in [0., .10]:\n",
    "    planned = results.prediction.clip(lower=0)*(1+buffer)\n",
    "    shortage = (results.actual-planned).clip(lower=0)\n",
    "    excess = (planned-results.actual).clip(lower=0)\n",
    "    scored = results.assign(cost=4*shortage+excess, shortage=shortage)\n",
    "    table = scored.groupby('method')[['cost','shortage']].sum()\n",
    "    table['buffer_pct'] = int(buffer*100)\n",
    "    policies.append(table.reset_index())\n",
    "policy_table = pd.concat(policies, ignore_index=True)\n",
    "display(policy_table.round(2))\n",
    "fig, ax = plt.subplots(figsize=(11,4))\n",
    "policy_table.pivot(index='method',columns='buffer_pct',values='cost').plot.barh(ax=ax)\n",
    "ax.set(title='Toy asymmetric cost: forecast choice and planning buffer both matter', xlabel='Assumed cost units')\n",
    "ax.legend(title='Buffer %'); plt.tight_layout(); plt.show()\n",
    "best = metrics.index[0]\n",
    "lowest_cost = policy_table.sort_values('cost').iloc[0]\n",
    "display(Markdown(f\"**Decision insight:** the lowest assumed cost is {lowest_cost['method']} with a {int(lowest_cost['buffer_pct'])}% buffer. The MAE winner is {best}. These answer different questions: how close is the forecast, and what does the proposed action cost? This is exploratory policy comparison, not validated savings.\"))\n",
    "display(Markdown(f\"**Observed:** {best} has the lowest aggregate MAE on these three synthetic blocks. \"\n",
    "                 \"Use the origin-level table to check consistency. \"\n",
    "                 \"DARR retrieval is worth investigating only if it adds value beyond simple seasonality and its compute cost. \"\n",
    "                 \"Carry the declared loss function into a separate real-data validation, rather than promising savings from this toy run.\"))\n"
   ],
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>method</th>\n",
       "      <th>cost</th>\n",
       "      <th>shortage</th>\n",
       "      <th>buffer_pct</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Daily seasonal</td>\n",
       "      <td>8466.72</td>\n",
       "      <td>1844.12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NV-Tesseract DARR</td>\n",
       "      <td>6907.28</td>\n",
       "      <td>1684.76</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NV-Tesseract direct</td>\n",
       "      <td>4394.14</td>\n",
       "      <td>862.99</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Persistence</td>\n",
       "      <td>7201.46</td>\n",
       "      <td>350.64</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Daily seasonal</td>\n",
       "      <td>5538.63</td>\n",
       "      <td>768.25</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>NV-Tesseract DARR</td>\n",
       "      <td>2991.03</td>\n",
       "      <td>426.51</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>NV-Tesseract direct</td>\n",
       "      <td>3179.50</td>\n",
       "      <td>113.15</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Persistence</td>\n",
       "      <td>8845.56</td>\n",
       "      <td>65.17</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                method     cost  shortage  buffer_pct\n",
       "0       Daily seasonal  8466.72   1844.12           0\n",
       "1    NV-Tesseract DARR  6907.28   1684.76           0\n",
       "2  NV-Tesseract direct  4394.14    862.99           0\n",
       "3          Persistence  7201.46    350.64           0\n",
       "4       Daily seasonal  5538.63    768.25          10\n",
       "5    NV-Tesseract DARR  2991.03    426.51          10\n",
       "6  NV-Tesseract direct  3179.50    113.15          10\n",
       "7          Persistence  8845.56     65.17          10"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"787.210625pt\" height=\"282.96pt\" viewBox=\"0 0 787.210625 282.96\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2026-10-06T14:15:37.731295</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.11.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 282.96 \n",
       "L 787.210625 282.96 \n",
       "L 787.210625 0 \n",
       "L 0 0 \n",
       "L 0 282.96 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 105.558125 243.3725 \n",
       "L 780.010625 243.3725 \n",
       "L 780.010625 29.925 \n",
       "L 105.558125 29.925 \n",
       "L 105.558125 243.3725 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 105.558125 243.3725 \n",
       "L 105.558125 29.925 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\"/>\n",
       "     <g id=\"text_1\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"105.558125\" y=\"257.4645\" transform=\"rotate(-0 105.558125 257.4645)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 250.791549 243.3725 \n",
       "L 250.791549 29.925 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\"/>\n",
       "     <g id=\"text_2\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"250.791549\" y=\"257.4645\" transform=\"rotate(-0 250.791549 257.4645)\">2000</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 396.024972 243.3725 \n",
       "L 396.024972 29.925 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\"/>\n",
       "     <g id=\"text_3\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"396.024972\" y=\"257.4645\" transform=\"rotate(-0 396.024972 257.4645)\">4000</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 541.258396 243.3725 \n",
       "L 541.258396 29.925 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\"/>\n",
       "     <g id=\"text_4\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"541.258396\" y=\"257.4645\" transform=\"rotate(-0 541.258396 257.4645)\">6000</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 686.491819 243.3725 \n",
       "L 686.491819 29.925 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\"/>\n",
       "     <g id=\"text_5\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #6f706a\" x=\"686.491819\" y=\"257.4645\" transform=\"rotate(-0 686.491819 257.4645)\">8000</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_6\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #484945\" x=\"442.784375\" y=\"273.843\" transform=\"rotate(-0 442.784375 273.843)\">Assumed cost units</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 105.558125 216.691563 \n",
       "L 780.010625 216.691563 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\"/>\n",
       "     <g id=\"text_7\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"99.558125\" y=\"220.737563\" transform=\"rotate(-0 99.558125 220.737563)\">Daily seasonal</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 105.558125 163.329688 \n",
       "L 780.010625 163.329688 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\"/>\n",
       "     <g id=\"text_8\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"99.558125\" y=\"167.375688\" transform=\"rotate(-0 99.558125 167.375688)\">NV-Tesseract DARR</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 105.558125 109.967813 \n",
       "L 780.010625 109.967813 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\"/>\n",
       "     <g id=\"text_9\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"99.558125\" y=\"114.013813\" transform=\"rotate(-0 99.558125 114.013813)\">NV-Tesseract direct</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 105.558125 56.605938 \n",
       "L 780.010625 56.605938 \n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: none; stroke: #e3e4de; stroke-width: 0.8; stroke-linecap: round\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\"/>\n",
       "     <g id=\"text_10\">\n",
       "      <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: end; fill: #6f706a\" x=\"99.558125\" y=\"60.651938\" transform=\"rotate(-0 99.558125 60.651938)\">Persistence</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_11\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: middle; fill: #484945\" x=\"15.768\" y=\"136.64875\" transform=\"rotate(-90 15.768 136.64875)\">method</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 105.558125 230.032031 \n",
       "L 720.383617 230.032031 \n",
       "L 720.383617 216.691563 \n",
       "L 105.558125 216.691563 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #0969da\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 105.558125 176.670156 \n",
       "L 607.14191 176.670156 \n",
       "L 607.14191 163.329688 \n",
       "L 105.558125 163.329688 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #0969da\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 105.558125 123.308281 \n",
       "L 424.646445 123.308281 \n",
       "L 424.646445 109.967813 \n",
       "L 105.558125 109.967813 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #0969da\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 105.558125 69.946406 \n",
       "L 628.504165 69.946406 \n",
       "L 628.504165 56.605938 \n",
       "L 105.558125 56.605938 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #0969da\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 105.558125 216.691563 \n",
       "L 507.755333 216.691563 \n",
       "L 507.755333 203.351094 \n",
       "L 105.558125 203.351094 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #1a7f64\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 105.558125 163.329688 \n",
       "L 322.756673 163.329688 \n",
       "L 322.756673 149.989219 \n",
       "L 105.558125 149.989219 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #1a7f64\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 105.558125 109.967813 \n",
       "L 336.442958 109.967813 \n",
       "L 336.442958 96.627344 \n",
       "L 105.558125 96.627344 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #1a7f64\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 105.558125 56.605938 \n",
       "L 747.893839 56.605938 \n",
       "L 747.893839 43.265469 \n",
       "L 105.558125 43.265469 \n",
       "z\n",
       "\" clip-path=\"url(#p1d8ae29546)\" style=\"fill: #1a7f64\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 105.558125 243.3725 \n",
       "L 105.558125 29.925 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 105.558125 243.3725 \n",
       "L 780.010625 243.3725 \n",
       "\" style=\"fill: none; stroke: #d1d2cb; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_12\">\n",
       "    <text style=\"font-weight: 600; font-size: 11px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #171817\" x=\"105.558125\" y=\"17.925\" transform=\"rotate(-0 105.558125 17.925)\">Toy asymmetric cost: forecast choice and planning buffer both matter</text>\n",
       "   </g>\n",
       "   <g id=\"legend_1\">\n",
       "    <g id=\"text_13\">\n",
       "     <text style=\"font-size: 9px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"736.667188\" y=\"205.5005\" transform=\"rotate(-0 736.667188 205.5005)\">Buffer %</text>\n",
       "    </g>\n",
       "    <g id=\"patch_13\">\n",
       "     <path d=\"M 737.888438 219.7595 \n",
       "L 754.888438 219.7595 \n",
       "L 754.888438 213.8095 \n",
       "L 737.888438 213.8095 \n",
       "z\n",
       "\" style=\"fill: #0969da\"/>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"761.688437\" y=\"219.7595\" transform=\"rotate(-0 761.688437 219.7595)\">0</text>\n",
       "    </g>\n",
       "    <g id=\"patch_14\">\n",
       "     <path d=\"M 737.888438 233.912 \n",
       "L 754.888438 233.912 \n",
       "L 754.888438 227.962 \n",
       "L 737.888438 227.962 \n",
       "z\n",
       "\" style=\"fill: #1a7f64\"/>\n",
       "    </g>\n",
       "    <g id=\"text_15\">\n",
       "     <text style=\"font-size: 8.5px; font-family: 'Inter', 'Helvetica Neue', 'Helvetica', 'Arial', 'DejaVu Sans', sans-serif; text-anchor: start; fill: #484945\" x=\"761.688437\" y=\"233.912\" transform=\"rotate(-0 761.688437 233.912)\">10</text>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p1d8ae29546\">\n",
       "   <rect x=\"105.558125\" y=\"29.925\" width=\"674.4525\" height=\"213.4475\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1100x400 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "**Decision insight:** the lowest assumed cost is NV-Tesseract DARR with a 10% buffer. The MAE winner is NV-Tesseract direct. These answer different questions: how close is the forecast, and what does the proposed action cost? This is exploratory policy comparison, not validated savings."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "**Observed:** NV-Tesseract direct has the lowest aggregate MAE on these three synthetic blocks. Use the origin-level table to check consistency. DARR retrieval is worth investigating only if it adds value beyond simple seasonality and its compute cost. Carry the declared loss function into a separate real-data validation, rather than promising savings from this toy run."
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ]
  },
  {
   "id": "cell-10",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## What breaks when the world changes?\n",
    "\n",
    "A forecast is conditional on the patterns it can observe. Reuse the **already frozen predictions** against a counterfactual 40% workload surge; no model sees the surge beforehand. This is a stress test, not a second independent accuracy benchmark. It makes the operational limitation visible without cherry-picking a nicer model run.\n"
   ]
  },
  {
   "id": "cell-11",
   "metadata": {},
   "cell_type": "code",
   "execution_count": 6,
   "source": [
    "shock = results.copy()\n",
    "shock['actual'] *= 1.4\n",
    "stress = shock.groupby('method').apply(lambda group: (group.prediction-group.actual).abs().mean(), include_groups=False)\n",
    "display(pd.DataFrame({'original_MAE': metrics.MAE, 'unannounced_surge_MAE': stress}).round(2))\n",
    "assert np.array_equal(shock.prediction.to_numpy(), results.prediction.to_numpy())\n",
    "print('Predictions remained frozen; only the synthetic counterfactual outcomes changed.')\n"
   ],
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>original_MAE</th>\n",
       "      <th>unannounced_surge_MAE</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Daily seasonal</th>\n",
       "      <td>13.59</td>\n",
       "      <td>50.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NV-Tesseract DARR</th>\n",
       "      <td>8.58</td>\n",
       "      <td>53.81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NV-Tesseract direct</th>\n",
       "      <td>8.36</td>\n",
       "      <td>46.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Persistence</th>\n",
       "      <td>28.47</td>\n",
       "      <td>31.73</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     original_MAE  unannounced_surge_MAE\n",
       "method                                                  \n",
       "Daily seasonal              13.59                  50.39\n",
       "NV-Tesseract DARR            8.58                  53.81\n",
       "NV-Tesseract direct          8.36                  46.44\n",
       "Persistence                 28.47                  31.73"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Predictions remained frozen; only the synthetic counterfactual outcomes changed.\n"
     ]
    }
   ]
  },
  {
   "id": "cell-12",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## What to carry into a real pilot\n",
    "\n",
    "- Use the actual forecast decision time to decide which inputs are legal. A timestamp split alone is insufficient if retrieval includes future continuations.\n",
    "- Keep persistence and seasonal baselines. Complexity needs a measured benefit.\n",
    "- Backtest across many origins, peak periods, and segments; reserve an untouched final interval for policy selection validation.\n",
    "- Use domain owners to set shortage/excess costs and escalation rules. The model must not automatically order stock, schedule staff, move funds, or change customer decisions.\n",
    "- These plots do not measure realized margin, staffing savings, fraud reduction, or production reliability. Record those separately in a human-reviewed pilot.\n",
    "\n",
    "The receipt below comes from the actual run.\n"
   ]
  },
  {
   "id": "cell-13",
   "metadata": {
    "tags": [
     "vit-result"
    ]
   },
   "cell_type": "code",
   "execution_count": 7,
   "source": [
    "display(JSON({'case_id': 'RET-01 / RET-09', 'model': 'nvidia/nv-tesseract-forecasting',\n",
    "              'device': DEVICE, 'origins': origins, 'horizon': HORIZON,\n",
    "              'seconds': [round(value,3) for value in timings],\n",
    "              'protocol': 'rolling-origin-disjoint-retrieval',\n",
    "              'metrics': metrics.to_dict(orient='index'),\n",
    "              'decision_policies': policy_table.to_dict(orient='records')}))\n"
   ],
   "outputs": [
    {
     "data": {
      "application/json": {
       "case_id": "RET-01 / RET-09",
       "decision_policies": [
        {
         "buffer_pct": 0,
         "cost": 8466.72173479142,
         "method": "Daily seasonal",
         "shortage": 1844.1162630566853
        },
        {
         "buffer_pct": 0,
         "cost": 6907.277573252261,
         "method": "NV-Tesseract DARR",
         "shortage": 1684.7593712786922
        },
        {
         "buffer_pct": 0,
         "cost": 4394.144440167894,
         "method": "NV-Tesseract direct",
         "shortage": 862.988581148635
        },
        {
         "buffer_pct": 0,
         "cost": 7201.455798176975,
         "method": "Persistence",
         "shortage": 350.6418256016484
        },
        {
         "buffer_pct": 10,
         "cost": 5538.631511850134,
         "method": "Daily seasonal",
         "shortage": 768.2477191175927
        },
        {
         "buffer_pct": 10,
         "cost": 2991.027031943494,
         "method": "NV-Tesseract DARR",
         "shortage": 426.51195771908687
        },
        {
         "buffer_pct": 10,
         "cost": 3179.499969113613,
         "method": "NV-Tesseract direct",
         "shortage": 113.1479652886086
        },
        {
         "buffer_pct": 10,
         "cost": 8845.563213305993,
         "method": "Persistence",
         "shortage": 65.17068426340106
        }
       ],
       "device": "mps",
       "horizon": 72,
       "metrics": {
        "Daily seasonal": {
         "MAE": 13.585059933432232,
         "WAPE_pct": 11.613742916177195
        },
        "NV-Tesseract DARR": {
         "MAE": 8.578701201000856,
         "WAPE_pct": 7.3338528347554375
        },
        "NV-Tesseract direct": {
         "MAE": 8.357308781120317,
         "WAPE_pct": 7.144586489175661
        },
        "Persistence": {
         "MAE": 28.47004778412977,
         "WAPE_pct": 24.338782264954425
        }
       },
       "model": "nvidia/nv-tesseract-forecasting",
       "origins": [
        1280,
        1352,
        1424
       ],
       "protocol": "rolling-origin-disjoint-retrieval",
       "seconds": [
        6.716,
        0.245,
        0.267
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "metadata": {
      "application/json": {
       "expanded": false,
       "root": "root"
      }
     },
     "output_type": "display_data"
    }
   ]
  },
  {
   "id": "cell-14",
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "## Sources and scope\n",
    "\n",
    "The source article frames forecasting as one task in a purpose-built model family.[1] This notebook uses NVIDIA's later public forecasting release: a MOMENT-based backbone with a trained forecasting head and optional DARR retrieval from historical windows.[2][3]\n",
    "Neither the synthetic fixture nor the MAE/cost results here reproduce NVIDIA's benchmarks. The model card labels the model for research and development.[3] No classification checkpoint is assumed. These are original teaching extensions of the enterprise casebooks, not completed enterprise implementations.\n",
    "\n",
    "## Sources\n",
    "\n",
    "[1] https://developer.nvidia.com/blog/new-nvidia-nv-tesseract-time-series-models-advance-dataset-processing-and-anomaly-detection — New NVIDIA NV-Tesseract Time Series Models Advance Dataset Processing and Anomaly Detection\n",
    "\n",
    "[2] https://github.com/NVIDIA/NV-Tesseract\n",
    "\n",
    "[3] https://huggingface.co/nvidia/nv-tesseract-forecasting\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.12.12"
  },
  "mementropy": {
   "contentKind": "notebook",
   "world": "northstar",
   "capabilities": [
    "workload-forecasting",
    "retrieval-augmented-forecasting",
    "decision-cost-analysis"
   ],
   "implementations": [
    "NV-Tesseract",
    "PyTorch",
    "NumPy",
    "pandas",
    "Matplotlib",
    "IPython",
    "MOMENT"
   ],
   "evidenceStatus": "executed-example",
   "updatedDate": "2026-10-29"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
