{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6c1b841945ac",
   "metadata": {},
   "source": [
    "# Chapter 3: How to Predict Emergence\n",
    "\n",
    "A curve can explain yesterday's observations beautifully and still fail at tomorrow's scale. The difference between explanation and forecasting lies partly in chronology: which observations were available when the family and coefficients were selected? If a test outcome helps choose the model, it is no longer independent evidence for the prediction it influenced.\n",
    "\n",
    "This notebook gives development and test observations separate fields. The coefficients are fitted from development data alone. The test data then scores that frozen forecast. The changed case leaves the fit untouched while changing unseen outcomes, making it impossible to confuse a stable fitted line with a successful prediction. This is a narrow implemented forecasting protocol, not a universal emergence predictor.\n",
    "\n",
    "**Outcome:** Fit a declared curve on development data and score a separate test.\n",
    "\n",
    "- Inspect the declared input contract\n",
    "- Predict the hand-checkable case\n",
    "- Run the shared computation\n",
    "- Change the critical assumption\n",
    "- Apply the method to the transfer data\n",
    "\n",
    "**Guided route:** Run the worked calculation, inspect its figure, change the stated assumption, and try the transfer case. Read the explanations beside each result before opening the answers.\n",
    "\n",
    "**Deeper route:** First read the mathematics and canonical equation reference. Audit the input contract, predict the changed result, then inspect the shared chapter implementation and solve the questions independently. Both routes use the same calculations and preserve the equations."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a7781f3ee7dc",
   "metadata": {},
   "source": [
    "## Technical Requirements\n",
    "\n",
    "Python 3.11 or later, the complete laboratory folder, and the notebook dependencies listed in `requirements-notebooks.txt` (the launcher's **Install notebook tools** choice installs them; see START-HERE). Standard-library chapter commands also support Python 3.10. No API key, model account or network call is used by this experiment.\n",
    "\n",
    "Prior knowledge:\n",
    "\n",
    "- Python lists and dictionaries\n",
    "- The mapped chapter and its notation"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "639828127f88",
   "metadata": {},
   "source": [
    "## The question and its mathematics\n",
    "\n",
    "The declared family is y=alpha+beta f(x), where f(x)=x for a linear fit or f(x)=log(x) for a log fit. Let z_i=f(x_i). Least squares gives beta=sum_i(z_i-z_bar)(y_i-y_bar)/sum_i(z_i-z_bar)^2 and alpha=y_bar-beta z_bar. Variation in the development scales is necessary because a zero denominator leaves the slope unidentified.\n",
    "\n",
    "At a test scale x_j, the frozen prediction is y_hat_j=alpha+beta f(x_j). Residuals are y_hat_j-y_j. Test RMSE is sqrt(mean residual squared), while bias is the signed mean residual. RMSE measures magnitude; bias distinguishes systematic overprediction from underprediction. Neither is a probability of being correct.\n",
    "\n",
    "The log family requires positive scales and interprets equal multiplicative scale changes as equal increments in its transformed coordinate. Family selection is part of the prospective protocol and must occur before seeing test outcomes. The software cannot verify the historical order of an external experiment, but it rejects overlapping development and test scales and never uses test y values in the fit."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f3557405796b",
   "metadata": {},
   "source": [
    "## A calculation you can run\n",
    "\n",
    "Supply two aligned development vectors and two aligned test vectors. State the family explicitly. The function validates finite values, dimensional alignment, development variation, and separation of scale sets. It computes coefficients, frozen predictions, residuals, RMSE, and bias.\n",
    "\n",
    "The forecast and unseen-observation figures share test scale and score units. The residual figure makes errors visible rather than hiding them beneath a fitted line. Run the default case, save its coefficients, and predict what will happen when only test_y changes. The coefficients must remain identical. If they move, test evidence leaked into fitting. For real data, keep a timestamped forecast artifact or preregistered protocol beside the exported result to support the prospective claim.\n",
    "\n",
    "The next cell finds the bundle and imports the same computation used by the chapter skill. It does not change your system Python."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "42ebefc0e5c1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path\n",
    "import sys, json\n",
    "LAB_ROOT = next((p for p in [Path.cwd(), *Path.cwd().parents] if (p / \"lab-manifest.json\").is_file()), None)\n",
    "if LAB_ROOT is None:\n",
    "    raise RuntimeError(\"Open this notebook from the complete extracted laboratory folder.\")\n",
    "sys.path.insert(0, str(LAB_ROOT / \"src\"))\n",
    "from math_ai_agents.core import analyze, report_text\n",
    "from math_ai_agents.plotting import figure_svg\n",
    "from IPython.display import SVG, display\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7fffde8c0edb",
   "metadata": {},
   "source": [
    "Set the declared inputs below. These are constructed teaching values, not measurements from a production agent. Change a value only after predicting what it should change."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0f41e36ebac7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 3: prospective-forecast\n",
      "Can a frozen forecast predict unseen capability observations?\n",
      "Evidence: constructed teaching example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"family\": \"linear\",\n",
      "  \"slope\": 0.1,\n",
      "  \"intercept\": 0.1,\n",
      "  \"predictions\": [\n",
      "    0.5,\n",
      "    0.6\n",
      "  ],\n",
      "  \"test_rmse\": 0.0,\n",
      "  \"test_bias\": 0.0\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Only development observations fit the declared family. Test outcomes score the frozen forecast and never update its coefficients.\n",
      "\n",
      "Assumptions:\n",
      "- Family selection is declared before the test is inspected.\n",
      "- Least squares describes the supplied development observations.\n",
      "\n",
      "Limitations:\n",
      "- Extrapolation validity and mechanism are not established by a good fit.\n",
      "- Protocol metadata is needed to establish real prospective separation.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "chapter = 3\n",
    "inputs = {'development_x': [1, 2, 3],\n",
    " 'development_y': [0.2, 0.3, 0.4],\n",
    " 'test_x': [4, 5],\n",
    " 'test_y': [0.5, 0.6],\n",
    " 'family': 'linear'}\n",
    "report = analyze(chapter, inputs)\n",
    "# This input was explicitly taken from the teaching fixture.\n",
    "report['evidence_kind'] = 'constructed teaching example'\n",
    "print(report_text(report))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "815ce3953def",
   "metadata": {},
   "source": [
    "The default development line has slope 0.1 and intercept 0.1. It predicts 0.5 and 0.6 at unseen scales 4 and 5, matching the supplied test outcomes. RMSE and bias are zero up to numerical rounding.\n",
    "\n",
    "The changed test outcomes are 0.8 and 0.95. The forecast remains 0.5 and 0.6 because the development data did not change. Residuals become -0.3 and -0.35, with negative bias and a positive RMSE. That failure is informative. Refitting after seeing it might improve the retrospective graph, but it would not repair the original prospective forecast.\n",
    "\n",
    "The plot below uses the calculated quantities. Read each panel's units before comparing its values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "590f57e74048",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Matplotlib is building the font cache; this may take a moment.\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\" width=\"576pt\" height=\"626.4pt\" viewBox=\"0 0 576 626.4\" version=\"1.1\"><title>Calculated chapter experiment</title><desc>Labeled plot of the explicitly supplied chapter inputs. See the adjacent explanation for assumptions.</desc>\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:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Mathematics of AI Agents Laboratory</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 626.4  L 576 626.4  L 576 0  L 0 0  z \" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 63.082344 210.119531  L 565.2 210.119531  L 565.2 79.520234  L 63.082344 79.520234  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path id=\"mebf30c5a82\" d=\"M 0 0  L 0 3.5  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"85.905874\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"224.717188\" transform=\"rotate(-0 85.905874 224.717188)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"177.199993\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"224.717188\" transform=\"rotate(-0 177.199993 224.717188)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"268.494112\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"224.717188\" transform=\"rotate(-0 268.494112 224.717188)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"359.788232\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"224.717188\" transform=\"rotate(-0 359.788232 224.717188)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"451.082351\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"224.717188\" transform=\"rotate(-0 451.082351 224.717188)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"542.37647\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"224.717188\" transform=\"rotate(-0 542.37647 224.717188)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_7\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"238.717969\" transform=\"rotate(-0 314.141172 238.717969)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 63.082344 204.1832  L 565.2 204.1832  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <defs>\n",
       "       <path id=\"mea6591b566\" d=\"M 0 0  L -3.5 0  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"204.1832\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"207.982028\" transform=\"rotate(-0 56.082344 207.982028)\">0.50</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 63.082344 180.437873  L 565.2 180.437873  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"180.437873\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"184.236701\" transform=\"rotate(-0 56.082344 184.236701)\">0.52</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 63.082344 156.692546  L 565.2 156.692546  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"156.692546\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"160.491374\" transform=\"rotate(-0 56.082344 160.491374)\">0.54</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 63.082344 132.947219  L 565.2 132.947219  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"132.947219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"136.746048\" transform=\"rotate(-0 56.082344 136.746048)\">0.56</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 63.082344 109.201893  L 565.2 109.201893  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"109.201893\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"113.000721\" transform=\"rotate(-0 56.082344 113.000721)\">0.58</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 63.082344 85.456566  L 565.2 85.456566  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"85.456566\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"89.255394\" transform=\"rotate(-0 56.082344 89.255394)\">0.60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"27.414375\" y=\"144.819883\" transform=\"rotate(-90 27.414375 144.819883)\">score</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_19\">\n",
       "    <path d=\"M 85.905874 204.1832  L 542.37647 85.456566  \" clip-path=\"url(#pfedbc3f949)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <defs>\n",
       "     <path id=\"m321e80ee20\" d=\"M 0 2  C 0.530406 2 1.03916 1.789267 1.414214 1.414214  C 1.789267 1.03916 2 0.530406 2 0  C 2 -0.530406 1.789267 -1.03916 1.414214 -1.414214  C 1.03916 -1.789267 0.530406 -2 0 -2  C -0.530406 -2 -1.03916 -1.789267 -1.414214 -1.414214  C -1.789267 -1.03916 -2 -0.530406 -2 0  C -2 0.530406 -1.789267 1.03916 -1.414214 1.414214  C -1.03916 1.789267 -0.530406 2 0 2  z \" style=\"stroke: #31586b\"/>\n",
       "    </defs>\n",
       "    <g clip-path=\"url(#pfedbc3f949)\">\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"85.905874\" y=\"204.1832\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"542.37647\" y=\"85.456566\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 63.082344 210.119531  L 63.082344 79.520234  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 63.082344 210.119531  L 565.2 210.119531  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_15\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"73.520234\" transform=\"rotate(-0 63.082344 73.520234)\">frozen forecast</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_2\">\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 63.082344 397.198594  L 565.2 397.198594  L 565.2 266.599297  L 63.082344 266.599297  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_3\">\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"85.905874\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_16\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"411.79625\" transform=\"rotate(-0 85.905874 411.79625)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"177.199993\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_17\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"411.79625\" transform=\"rotate(-0 177.199993 411.79625)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"268.494112\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_18\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"411.79625\" transform=\"rotate(-0 268.494112 411.79625)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"359.788232\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_19\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"411.79625\" transform=\"rotate(-0 359.788232 411.79625)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_11\">\n",
       "     <g id=\"line2d_24\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"451.082351\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_20\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"411.79625\" transform=\"rotate(-0 451.082351 411.79625)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_12\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"542.37647\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_21\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"411.79625\" transform=\"rotate(-0 542.37647 411.79625)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_22\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"425.797031\" transform=\"rotate(-0 314.141172 425.797031)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_4\">\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_26\">\n",
       "      <path d=\"M 63.082344 391.262262  L 565.2 391.262262  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_27\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"391.262262\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_23\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"395.06109\" transform=\"rotate(-0 56.082344 395.06109)\">0.50</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_28\">\n",
       "      <path d=\"M 63.082344 367.516935  L 565.2 367.516935  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_29\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"367.516935\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_24\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"371.315763\" transform=\"rotate(-0 56.082344 371.315763)\">0.52</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_30\">\n",
       "      <path d=\"M 63.082344 343.771609  L 565.2 343.771609  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_31\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"343.771609\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_25\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"347.570437\" transform=\"rotate(-0 56.082344 347.570437)\">0.54</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_10\">\n",
       "     <g id=\"line2d_32\">\n",
       "      <path d=\"M 63.082344 320.026282  L 565.2 320.026282  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_33\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"320.026282\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_26\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"323.82511\" transform=\"rotate(-0 56.082344 323.82511)\">0.56</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_11\">\n",
       "     <g id=\"line2d_34\">\n",
       "      <path d=\"M 63.082344 296.280955  L 565.2 296.280955  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_35\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"296.280955\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_27\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"300.079783\" transform=\"rotate(-0 56.082344 300.079783)\">0.58</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_12\">\n",
       "     <g id=\"line2d_36\">\n",
       "      <path d=\"M 63.082344 272.535629  L 565.2 272.535629  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_37\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"272.535629\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_28\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"276.334457\" transform=\"rotate(-0 56.082344 276.334457)\">0.60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_29\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"27.414375\" y=\"331.898945\" transform=\"rotate(-90 27.414375 331.898945)\">score</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_38\">\n",
       "    <path d=\"M 85.905874 391.262262  L 542.37647 272.535629  \" clip-path=\"url(#p01eb6bf1b7)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <g clip-path=\"url(#p01eb6bf1b7)\">\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"85.905874\" y=\"391.262262\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"542.37647\" y=\"272.535629\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 63.082344 397.198594  L 63.082344 266.599297  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 63.082344 397.198594  L 565.2 397.198594  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_30\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"260.599297\" transform=\"rotate(-0 63.082344 260.599297)\">unseen observation</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_3\">\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 63.082344 584.277656  L 565.2 584.277656  L 565.2 453.678359  L 63.082344 453.678359  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_5\">\n",
       "    <g id=\"xtick_13\">\n",
       "     <g id=\"line2d_39\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"85.905874\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_31\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"598.875312\" transform=\"rotate(-0 85.905874 598.875312)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_14\">\n",
       "     <g id=\"line2d_40\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"177.199993\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_32\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"598.875312\" transform=\"rotate(-0 177.199993 598.875312)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_15\">\n",
       "     <g id=\"line2d_41\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"268.494112\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_33\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"598.875312\" transform=\"rotate(-0 268.494112 598.875312)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_16\">\n",
       "     <g id=\"line2d_42\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"359.788232\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_34\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"598.875312\" transform=\"rotate(-0 359.788232 598.875312)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_17\">\n",
       "     <g id=\"line2d_43\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"451.082351\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_35\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"598.875312\" transform=\"rotate(-0 451.082351 598.875312)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_18\">\n",
       "     <g id=\"line2d_44\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mebf30c5a82\" x=\"542.37647\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_36\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"598.875312\" transform=\"rotate(-0 542.37647 598.875312)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_37\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"612.876094\" transform=\"rotate(-0 314.141172 612.876094)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_6\">\n",
       "    <g id=\"ytick_13\">\n",
       "     <g id=\"line2d_45\">\n",
       "      <path d=\"M 63.082344 566.468661  L 565.2 566.468661  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_46\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"566.468661\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_38\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"570.267489\" transform=\"rotate(-0 56.082344 570.267489)\">−0.04</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_14\">\n",
       "     <g id=\"line2d_47\">\n",
       "      <path d=\"M 63.082344 542.723335  L 565.2 542.723335  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_48\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"542.723335\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_39\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"546.522163\" transform=\"rotate(-0 56.082344 546.522163)\">−0.02</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_15\">\n",
       "     <g id=\"line2d_49\">\n",
       "      <path d=\"M 63.082344 518.978008  L 565.2 518.978008  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_50\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"518.978008\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_40\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"522.776836\" transform=\"rotate(-0 56.082344 522.776836)\">0.00</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_16\">\n",
       "     <g id=\"line2d_51\">\n",
       "      <path d=\"M 63.082344 495.232681  L 565.2 495.232681  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_52\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"495.232681\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_41\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"499.031509\" transform=\"rotate(-0 56.082344 499.031509)\">0.02</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_17\">\n",
       "     <g id=\"line2d_53\">\n",
       "      <path d=\"M 63.082344 471.487354  L 565.2 471.487354  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_54\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mea6591b566\" x=\"63.082344\" y=\"471.487354\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_42\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"475.286183\" transform=\"rotate(-0 56.082344 475.286183)\">0.04</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_43\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"19.034688\" y=\"518.978008\" transform=\"rotate(-90 19.034688 518.978008)\">prediction minus observation</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_55\">\n",
       "    <path d=\"M 85.905874 518.978008  L 542.37647 518.978008  \" clip-path=\"url(#p22b861bcc1)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <g clip-path=\"url(#p22b861bcc1)\">\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"85.905874\" y=\"518.978008\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m321e80ee20\" x=\"542.37647\" y=\"518.978008\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 63.082344 584.277656  L 63.082344 453.678359  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 63.082344 584.277656  L 565.2 584.277656  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_44\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"447.678359\" transform=\"rotate(-0 63.082344 447.678359)\">forecast residual</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"text_45\">\n",
       "   <text style=\"font-size: 12px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"46.08\" y=\"21.646125\" transform=\"rotate(-0 46.08 21.646125)\">Chapter 3: prospective forecast</text>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pfedbc3f949\">\n",
       "   <rect x=\"63.082344\" y=\"79.520234\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p01eb6bf1b7\">\n",
       "   <rect x=\"63.082344\" y=\"266.599297\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p22b861bcc1\">\n",
       "   <rect x=\"63.082344\" y=\"453.678359\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(SVG(figure_svg(report)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0adc732fdff9",
   "metadata": {},
   "source": [
    "**Figure 3.L1:** Calculated chapter experiment. Each panel labels its input and output units; interpret it under the assumptions printed in the report."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "644ce3385e21",
   "metadata": {},
   "source": [
    "## Change the assumption\n",
    "\n",
    "The simplest leakage pattern is to move a disappointing test observation into the development set and continue calling the remaining assessment unseen. Another is to inspect several families against the same test outcomes and report only the best one. Both use the test to shape the prediction, so the reported errors cease to measure the original prospective protocol.\n",
    "\n",
    "The implementation checks explicit scale overlap, but it cannot detect hidden reuse, shared tasks, or a family chosen after reading test results. Those are evidence-management problems. Record the family, data boundary, fit command, and forecast before opening the withheld outcome file.\n",
    "\n",
    "A successful linear or log extrapolation also does not reveal an emergence mechanism. It is conditional performance of one declared family over one supplied range. New environments or measurement rules can break that relationship even if the development residuals were tiny."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "bf2f5b422c33",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 3: prospective-forecast\n",
      "Can a frozen forecast predict unseen capability observations?\n",
      "Evidence: constructed changed-assumption example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"family\": \"linear\",\n",
      "  \"slope\": 0.1,\n",
      "  \"intercept\": 0.1,\n",
      "  \"predictions\": [\n",
      "    0.5,\n",
      "    0.6\n",
      "  ],\n",
      "  \"test_rmse\": 0.3259601203,\n",
      "  \"test_bias\": -0.325\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Only development observations fit the declared family. Test outcomes score the frozen forecast and never update its coefficients.\n",
      "\n",
      "Assumptions:\n",
      "- Family selection is declared before the test is inspected.\n",
      "- Least squares describes the supplied development observations.\n",
      "\n",
      "Limitations:\n",
      "- Extrapolation validity and mechanism are not established by a good fit.\n",
      "- Protocol metadata is needed to establish real prospective separation.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\" width=\"576pt\" height=\"626.4pt\" viewBox=\"0 0 576 626.4\" version=\"1.1\"><title>Calculated chapter experiment</title><desc>Labeled plot of the explicitly supplied chapter inputs. See the adjacent explanation for assumptions.</desc>\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:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Mathematics of AI Agents Laboratory</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 626.4  L 576 626.4  L 576 0  L 0 0  z \" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 63.082344 210.119531  L 565.2 210.119531  L 565.2 79.520234  L 63.082344 79.520234  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path id=\"m49566233ff\" d=\"M 0 0  L 0 3.5  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"85.905874\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"224.717188\" transform=\"rotate(-0 85.905874 224.717188)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"177.199993\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"224.717188\" transform=\"rotate(-0 177.199993 224.717188)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"268.494112\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"224.717188\" transform=\"rotate(-0 268.494112 224.717188)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"359.788232\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"224.717188\" transform=\"rotate(-0 359.788232 224.717188)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"451.082351\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"224.717188\" transform=\"rotate(-0 451.082351 224.717188)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"542.37647\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"224.717188\" transform=\"rotate(-0 542.37647 224.717188)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_7\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"238.717969\" transform=\"rotate(-0 314.141172 238.717969)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 63.082344 204.1832  L 565.2 204.1832  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <defs>\n",
       "       <path id=\"mf6b32edc5a\" d=\"M 0 0  L -3.5 0  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"204.1832\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"207.982028\" transform=\"rotate(-0 56.082344 207.982028)\">0.50</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 63.082344 180.437873  L 565.2 180.437873  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"180.437873\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"184.236701\" transform=\"rotate(-0 56.082344 184.236701)\">0.52</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 63.082344 156.692546  L 565.2 156.692546  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"156.692546\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"160.491374\" transform=\"rotate(-0 56.082344 160.491374)\">0.54</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 63.082344 132.947219  L 565.2 132.947219  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"132.947219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"136.746048\" transform=\"rotate(-0 56.082344 136.746048)\">0.56</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 63.082344 109.201893  L 565.2 109.201893  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"109.201893\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"113.000721\" transform=\"rotate(-0 56.082344 113.000721)\">0.58</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 63.082344 85.456566  L 565.2 85.456566  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"85.456566\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_13\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"89.255394\" transform=\"rotate(-0 56.082344 89.255394)\">0.60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_14\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"27.414375\" y=\"144.819883\" transform=\"rotate(-90 27.414375 144.819883)\">score</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_19\">\n",
       "    <path d=\"M 85.905874 204.1832  L 542.37647 85.456566  \" clip-path=\"url(#p11f476d864)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <defs>\n",
       "     <path id=\"m7209ba9896\" d=\"M 0 2  C 0.530406 2 1.03916 1.789267 1.414214 1.414214  C 1.789267 1.03916 2 0.530406 2 0  C 2 -0.530406 1.789267 -1.03916 1.414214 -1.414214  C 1.03916 -1.789267 0.530406 -2 0 -2  C -0.530406 -2 -1.03916 -1.789267 -1.414214 -1.414214  C -1.789267 -1.03916 -2 -0.530406 -2 0  C -2 0.530406 -1.789267 1.03916 -1.414214 1.414214  C -1.03916 1.789267 -0.530406 2 0 2  z \" style=\"stroke: #31586b\"/>\n",
       "    </defs>\n",
       "    <g clip-path=\"url(#p11f476d864)\">\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"85.905874\" y=\"204.1832\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"542.37647\" y=\"85.456566\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 63.082344 210.119531  L 63.082344 79.520234  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 63.082344 210.119531  L 565.2 210.119531  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_15\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"73.520234\" transform=\"rotate(-0 63.082344 73.520234)\">frozen forecast</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_2\">\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 63.082344 397.198594  L 565.2 397.198594  L 565.2 266.599297  L 63.082344 266.599297  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_3\">\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"85.905874\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_16\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"411.79625\" transform=\"rotate(-0 85.905874 411.79625)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"177.199993\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_17\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"411.79625\" transform=\"rotate(-0 177.199993 411.79625)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"268.494112\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_18\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"411.79625\" transform=\"rotate(-0 268.494112 411.79625)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"359.788232\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_19\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"411.79625\" transform=\"rotate(-0 359.788232 411.79625)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_11\">\n",
       "     <g id=\"line2d_24\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"451.082351\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_20\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"411.79625\" transform=\"rotate(-0 451.082351 411.79625)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_12\">\n",
       "     <g id=\"line2d_25\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"542.37647\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_21\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"411.79625\" transform=\"rotate(-0 542.37647 411.79625)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_22\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"425.797031\" transform=\"rotate(-0 314.141172 425.797031)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_4\">\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_26\">\n",
       "      <path d=\"M 63.082344 391.262262  L 565.2 391.262262  \" clip-path=\"url(#pd5ee3328e4)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_27\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"391.262262\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_23\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"395.06109\" transform=\"rotate(-0 56.082344 395.06109)\">0.80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_28\">\n",
       "      <path d=\"M 63.082344 351.686718  L 565.2 351.686718  \" clip-path=\"url(#pd5ee3328e4)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_29\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"351.686718\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_24\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"355.485546\" transform=\"rotate(-0 56.082344 355.485546)\">0.85</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_30\">\n",
       "      <path d=\"M 63.082344 312.111173  L 565.2 312.111173  \" clip-path=\"url(#pd5ee3328e4)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_31\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"312.111173\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_25\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"315.910001\" transform=\"rotate(-0 56.082344 315.910001)\">0.90</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_10\">\n",
       "     <g id=\"line2d_32\">\n",
       "      <path d=\"M 63.082344 272.535629  L 565.2 272.535629  \" clip-path=\"url(#pd5ee3328e4)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_33\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"272.535629\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_26\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"276.334457\" transform=\"rotate(-0 56.082344 276.334457)\">0.95</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_27\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"27.414375\" y=\"331.898945\" transform=\"rotate(-90 27.414375 331.898945)\">score</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_34\">\n",
       "    <path d=\"M 85.905874 391.262262  L 542.37647 272.535629  \" clip-path=\"url(#pd5ee3328e4)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <g clip-path=\"url(#pd5ee3328e4)\">\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"85.905874\" y=\"391.262262\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"542.37647\" y=\"272.535629\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 63.082344 397.198594  L 63.082344 266.599297  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 63.082344 397.198594  L 565.2 397.198594  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_28\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"260.599297\" transform=\"rotate(-0 63.082344 260.599297)\">unseen observation</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_3\">\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 63.082344 584.277656  L 565.2 584.277656  L 565.2 453.678359  L 63.082344 453.678359  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_5\">\n",
       "    <g id=\"xtick_13\">\n",
       "     <g id=\"line2d_35\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"85.905874\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_29\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"85.905874\" y=\"598.875312\" transform=\"rotate(-0 85.905874 598.875312)\">4.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_14\">\n",
       "     <g id=\"line2d_36\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"177.199993\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_30\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"177.199993\" y=\"598.875312\" transform=\"rotate(-0 177.199993 598.875312)\">4.2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_15\">\n",
       "     <g id=\"line2d_37\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"268.494112\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_31\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"268.494112\" y=\"598.875312\" transform=\"rotate(-0 268.494112 598.875312)\">4.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_16\">\n",
       "     <g id=\"line2d_38\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"359.788232\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_32\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"359.788232\" y=\"598.875312\" transform=\"rotate(-0 359.788232 598.875312)\">4.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_17\">\n",
       "     <g id=\"line2d_39\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"451.082351\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_33\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"451.082351\" y=\"598.875312\" transform=\"rotate(-0 451.082351 598.875312)\">4.8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_18\">\n",
       "     <g id=\"line2d_40\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m49566233ff\" x=\"542.37647\" y=\"584.277656\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_34\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"542.37647\" y=\"598.875312\" transform=\"rotate(-0 542.37647 598.875312)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_35\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"314.141172\" y=\"612.876094\" transform=\"rotate(-0 314.141172 612.876094)\">test scale</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_6\">\n",
       "    <g id=\"ytick_11\">\n",
       "     <g id=\"line2d_41\">\n",
       "      <path d=\"M 63.082344 578.341325  L 565.2 578.341325  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_42\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"578.341325\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_36\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"582.140153\" transform=\"rotate(-0 56.082344 582.140153)\">−0.35</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_12\">\n",
       "     <g id=\"line2d_43\">\n",
       "      <path d=\"M 63.082344 554.595998  L 565.2 554.595998  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_44\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"554.595998\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_37\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"558.394826\" transform=\"rotate(-0 56.082344 558.394826)\">−0.34</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_13\">\n",
       "     <g id=\"line2d_45\">\n",
       "      <path d=\"M 63.082344 530.850671  L 565.2 530.850671  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_46\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"530.850671\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_38\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"534.649499\" transform=\"rotate(-0 56.082344 534.649499)\">−0.33</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_14\">\n",
       "     <g id=\"line2d_47\">\n",
       "      <path d=\"M 63.082344 507.105344  L 565.2 507.105344  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_48\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"507.105344\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_39\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"510.904173\" transform=\"rotate(-0 56.082344 510.904173)\">−0.32</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_15\">\n",
       "     <g id=\"line2d_49\">\n",
       "      <path d=\"M 63.082344 483.360018  L 565.2 483.360018  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_50\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"483.360018\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_40\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"487.158846\" transform=\"rotate(-0 56.082344 487.158846)\">−0.31</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_16\">\n",
       "     <g id=\"line2d_51\">\n",
       "      <path d=\"M 63.082344 459.614691  L 565.2 459.614691  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_52\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mf6b32edc5a\" x=\"63.082344\" y=\"459.614691\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_41\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"56.082344\" y=\"463.413519\" transform=\"rotate(-0 56.082344 463.413519)\">−0.30</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_42\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"19.034688\" y=\"518.978008\" transform=\"rotate(-90 19.034688 518.978008)\">prediction minus observation</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_53\">\n",
       "    <path d=\"M 85.905874 459.614691  L 542.37647 578.341325  \" clip-path=\"url(#p5a74e4453d)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "    <g clip-path=\"url(#p5a74e4453d)\">\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"85.905874\" y=\"459.614691\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "     <use xlink:href=\"#m7209ba9896\" x=\"542.37647\" y=\"578.341325\" style=\"fill: #31586b; stroke: #31586b\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 63.082344 584.277656  L 63.082344 453.678359  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 63.082344 584.277656  L 565.2 584.277656  \" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_43\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"63.082344\" y=\"447.678359\" transform=\"rotate(-0 63.082344 447.678359)\">forecast residual</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"text_44\">\n",
       "   <text style=\"font-size: 12px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"46.08\" y=\"21.646125\" transform=\"rotate(-0 46.08 21.646125)\">Chapter 3: prospective forecast</text>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p11f476d864\">\n",
       "   <rect x=\"63.082344\" y=\"79.520234\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"pd5ee3328e4\">\n",
       "   <rect x=\"63.082344\" y=\"266.599297\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p5a74e4453d\">\n",
       "   <rect x=\"63.082344\" y=\"453.678359\" width=\"502.117656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "changed_inputs = {'development_x': [1, 2, 3],\n",
    " 'development_y': [0.2, 0.3, 0.4],\n",
    " 'test_x': [4, 5],\n",
    " 'test_y': [0.8, 0.95],\n",
    " 'family': 'linear'}\n",
    "changed = analyze(chapter, changed_inputs)\n",
    "changed['evidence_kind'] = 'constructed changed-assumption example'\n",
    "print(report_text(changed))\n",
    "display(SVG(figure_svg(changed)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6a30d83d1cd8",
   "metadata": {},
   "source": [
    "**Figure 3.L2:** The changed-assumption result. Compare the printed quantities and the stated assumptions with the first run. A different input need not imply a causal effect in a deployed agent."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1fadc04869c0",
   "metadata": {},
   "source": [
    "## Try a new case\n",
    "\n",
    "The transfer data follows a logarithmic family. Doubling scale adds approximately log(2) to its outcome. Fit in log coordinates, then predict at scales 8 and 16. The slope is approximately 1 and the intercept approximately zero, so the predictions are approximately 2.0794 and 2.7726.\n",
    "\n",
    "When applying the method locally, define the forecast target before choosing the family. It might be a continuous score, a completion probability, or another declared quantity. The runtime allows finite targets without pretending all are probabilities. Explain the target units and score transformation in the accompanying report. If a bounded probability is required, this unconstrained regression may be the wrong family."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f7068a2bc071",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 3: prospective-forecast\n",
      "Can a frozen forecast predict unseen capability observations?\n",
      "Evidence: constructed transfer example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"family\": \"log\",\n",
      "  \"slope\": 1.0,\n",
      "  \"intercept\": 0.0,\n",
      "  \"predictions\": [\n",
      "    2.079441542,\n",
      "    2.772588722\n",
      "  ],\n",
      "  \"test_rmse\": 0.0,\n",
      "  \"test_bias\": 0.0\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Only development observations fit the declared family. Test outcomes score the frozen forecast and never update its coefficients.\n",
      "\n",
      "Assumptions:\n",
      "- Family selection is declared before the test is inspected.\n",
      "- Least squares describes the supplied development observations.\n",
      "\n",
      "Limitations:\n",
      "- Extrapolation validity and mechanism are not established by a good fit.\n",
      "- Protocol metadata is needed to establish real prospective separation.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "transfer_inputs = {'development_x': [1, 2, 4],\n",
    " 'development_y': [0, 0.69314718056, 1.38629436112],\n",
    " 'test_x': [8, 16],\n",
    " 'test_y': [2.07944154168, 2.77258872224],\n",
    " 'family': 'log'}\n",
    "transfer = analyze(chapter, transfer_inputs)\n",
    "transfer['evidence_kind'] = 'constructed transfer example'\n",
    "print(report_text(transfer))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "896f04cca377",
   "metadata": {},
   "source": [
    "## Apply the method to your inputs\n",
    "\n",
    "The example file below has the exact input shape the method accepts. Copy it to a new file, replace its values, then point `reader_file` at your copy. Run the cell again. Supplied inputs retain their stated provenance; the program cannot establish that they are representative observations.\n",
    "\n",
    "- **development_x:** At least two development scales with variation.\n",
    "- **development_y:** Aligned finite development observations.\n",
    "- **test_x:** Separate unseen scales, with no development overlap.\n",
    "- **test_y:** Aligned withheld observations used only for scoring.\n",
    "- **family:** linear or log, declared before inspecting test outcomes."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "a4f5029afee1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 3: prospective-forecast\n",
      "Can a frozen forecast predict unseen capability observations?\n",
      "Evidence: supplied local inputs; provenance not independently verified\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"family\": \"log\",\n",
      "  \"slope\": 1.0,\n",
      "  \"intercept\": 0.0,\n",
      "  \"predictions\": [\n",
      "    2.079441542,\n",
      "    2.772588722\n",
      "  ],\n",
      "  \"test_rmse\": 0.0,\n",
      "  \"test_bias\": 0.0\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Only development observations fit the declared family. Test outcomes score the frozen forecast and never update its coefficients.\n",
      "\n",
      "Assumptions:\n",
      "- Family selection is declared before the test is inspected.\n",
      "- Least squares describes the supplied development observations.\n",
      "\n",
      "Limitations:\n",
      "- Extrapolation validity and mechanism are not established by a good fit.\n",
      "- Protocol metadata is needed to establish real prospective separation.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "reader_file = LAB_ROOT / 'data/examples/ch03.json'\n",
    "reader_inputs = json.loads(reader_file.read_text())\n",
    "reader_report = analyze(chapter, reader_inputs)\n",
    "print(report_text(reader_report))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d2c4a4b1bc7",
   "metadata": {},
   "source": [
    "## Questions\n",
    "\n",
    "1. What are default fit coefficients?\n",
    "\n",
    "2. Does the changed test update the fit?\n",
    "\n",
    "3. Why must log-family scales be positive?\n",
    "\n",
    "Answers: [separate solutions](../solutions/ch03.md). Try the calculation before opening them."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d523bab3ed7",
   "metadata": {},
   "source": [
    "## Summary\n",
    "\n",
    "A forecast is prospective only when its choices are frozen before the outcomes used to evaluate it. This computation separates development fitting from test scoring and reports both magnitude and direction of error. The changed case preserves coefficients while exposing forecast failure; the transfer case changes the declared family. Good fit does not establish mechanism, universality, or calibration. Preserve the chronology and input boundary so the numerical result can be interpreted as evidence for the protocol that actually ran.\n",
    "\n",
    "Limits of this experiment:\n",
    "\n",
    "- This is a local calculation under declared inputs, not an empirical claim about a deployed agent.\n",
    "- Read the returned assumptions and limitations before applying the numerical result.\n",
    "\n",
    "The assistant skill is [`maa-03-prospective-forecast`](../skills/maa-03-prospective-forecast/SKILL.md). It uses this notebook's tested computation and input contract."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9cc9f25ba898",
   "metadata": {},
   "source": [
    "## Equations from the chapter\n",
    "\n",
    "These are the unchanged display equations and their explanations from the canonical chapter. They are a reference for the experiment, not a claim that every equation is numerically implemented by this one method."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "631ab8b2fda7",
   "metadata": {},
   "source": [
    "### Equation 3.1\n",
    "\n",
    "![Equation 3.1](../assets/math/90f0aa7fdfb7e63b6cf0.svg)\n",
    "\n",
    "Equation (3.1) is a fitted curve that lets a handful of completed training runs predict the loss of a much larger run that has not finished.\n",
    "\n",
    "`C` is training compute and `a`, `b`, `c` are constants chosen to fit the smaller runs, so a larger `C` reads off a prediction.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "L(C)=aC^b+c.\n",
    "\\tag{3.1}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9838278203c9",
   "metadata": {},
   "source": [
    "### Equation 3.2\n",
    "\n",
    "![Equation 3.2](../assets/math/71ad5d194fa8ee0de514.svg)\n",
    "\n",
    "Equation (3.2) proposes that a member's measured interaction is explained by declared features plus leftover error, which is a modeling choice rather than an existing result.\n",
    "\n",
    "The measured interaction for member `m` equals a fitted function of the declared features `z_m`, plus the part that fit misses.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "\\Gamma_m=f_\\psi(z_m)+\\epsilon_m.\n",
    "\\tag{3.2}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "926755fa1af8",
   "metadata": {},
   "source": [
    "### Equation 3.3\n",
    "\n",
    "![Equation 3.3](../assets/math/a432c7b620a94ad9171b.svg)\n",
    "\n",
    "Equation (3.3) turns a continuous success probability into a single pass-or-fail bit using a cutoff chosen in advance.\n",
    "\n",
    "Compare the member's success probability against the threshold and report one when it reaches the threshold, zero otherwise.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "\\operatorname{pass}_\\tau(q_m)=\\mathbf{1}\\{q_m\\geq\\tau\\}.\n",
    "\\tag{3.3}\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Mathematics of AI Agents",
   "language": "python",
   "name": "maa-lab"
  },
  "lab_chapter": 3,
  "lab_execution": {
   "code_cells": 6,
   "created_utc": "2026-10-02T05:13:20.559049+00:00",
   "elapsed_seconds": 8.833646249957383,
   "method": "fresh process; new ipykernel InProcessKernelManager; cells submitted as Jupyter execute requests",
   "network_transport_tested": false,
   "python": "3.11.15",
   "source_sha256": "0e314ae86fd181231f38f1e12b81255a7edfc5866811624370ddfea73c33b7db"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
