{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7ba66754d156",
   "metadata": {},
   "source": [
    "# Chapter 11: The Mathematics of Curiosity\n",
    "\n",
    "A controller has two tools and limited opportunities to learn which one works more often. Always choosing the current favorite can waste the budget if early evidence was misleading. Always exploring can waste it even after the better tool is apparent. Curiosity is therefore a resource decision, not an unlimited appetite for information.\n",
    "\n",
    "This notebook compares three finite policies against a constructed Bernoulli world. The true arm means are supplied to the simulator for scoring, while each policy chooses using its own observed successes. The chart measures pseudo-regret rather than presenting a lucky reward trace as proof of superiority. Change the arm ordering and seed before drawing a policy conclusion.\n",
    "\n",
    "**Outcome:** Compare greedy, UCB, and Thompson choices in a declared stationary bandit.\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": "519c5805ae9f",
   "metadata": {},
   "source": [
    "## The question and its mathematics\n",
    "\n",
    "After n_a pulls and s_a successes, the empirical mean is s_a/n_a. Greedy choice selects the largest empirical mean. UCB adds an exploration bonus sqrt(2 ln t / n_a), where t is the number of completed pulls (Equation 11.2 with c equal to the square root of two), favoring arms whose uncertainty remains large relative to their evidence.\n",
    "\n",
    "Thompson sampling uses a Beta(1,1) prior for each Bernoulli arm. Its posterior is Beta(s_a+1,n_a-s_a+1). Each round draws one candidate mean from each posterior and chooses the largest draw. A posterior sample is a decision device, not a certificate that an arm's true mean equals that sampled value.\n",
    "\n",
    "Cumulative pseudo-regret is sum_t [max_a mu_a-mu_(A_t)]. It uses the simulator's known means and measures expected reward forgone by choices. Realized net reward sums observed zero/one outcomes minus pull costs. These differ because sampling noise can favor a worse arm in a finite run. Information value is another quantity: it prices how evidence improves a future decision, not the historical cumulative shortfall.\n",
    "\n",
    "A separate one-pull information calculation uses the final Beta posterior. For each possible sampled arm, it averages the best posterior mean after a hypothetical success or failure, then subtracts the best current posterior mean. The net value also subtracts one pull cost. This is the Bayesian value of information for one later arm choice, not cumulative regret or a recommendation to continue the original budget."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24021c3c915e",
   "metadata": {},
   "source": [
    "## A calculation you can run\n",
    "\n",
    "Supply arm means, a finite round budget, seed, and common pull cost. Each policy initializes untried arms once while budget remains, then uses its own decision rule. The simulator samples outcomes with a local seeded random generator, preserving offline reproducibility without modifying global random state.\n",
    "\n",
    "The report gives pull counts, successes, pseudo-regret, and realized net reward for all policies. Curves show cumulative pseudo-regret by round. They are nondecreasing because each known-mean shortfall is nonnegative. Compare how frequently each policy visits the better arm, but do not rank policies statistically from a single seed. The changed case swaps means, testing whether early sampling and tie order affect the finite outcome.\n",
    "\n",
    "The returned policy table also contains posterior means and gross/net one-pull information values. Inspect those separately from the regret chart: a policy can have accumulated regret even when an additional observation no longer changes its preferred action.\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": "44621b3d5b89",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 11: bounded-exploration\n",
      "How much does a finite exploration policy pay to learn which action is better?\n",
      "Evidence: constructed teaching example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"policies\": {\n",
      "    \"greedy\": {\n",
      "      \"counts\": [\n",
      "        2,\n",
      "        118\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        1,\n",
      "        89\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 0.6,\n",
      "      \"net_observed_reward\": 84.0,\n",
      "      \"posterior_means\": [\n",
      "        0.5,\n",
      "        0.75\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    },\n",
      "    \"ucb\": {\n",
      "      \"counts\": [\n",
      "        31,\n",
      "        89\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        16,\n",
      "        67\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 9.3,\n",
      "      \"net_observed_reward\": 77.0,\n",
      "      \"posterior_means\": [\n",
      "        0.5151515152,\n",
      "        0.7472527473\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    },\n",
      "    \"thompson\": {\n",
      "      \"counts\": [\n",
      "        46,\n",
      "        74\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        31,\n",
      "        54\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 13.8,\n",
      "      \"net_observed_reward\": 79.0,\n",
      "      \"posterior_means\": [\n",
      "        0.6666666667,\n",
      "        0.7236842105\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    }\n",
      "  },\n",
      "  \"oracle_mean\": 0.7,\n",
      "  \"seed\": 7\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Pseudo-regret uses known constructed means, whereas realized reward comes from seeded Bernoulli draws. Posterior sampling draws a belief; it does not certify an arm.\n",
      "\n",
      "Assumptions:\n",
      "- Stationary independent Bernoulli rewards within each arm.\n",
      "- All policies initialize each arm once when the budget permits.\n",
      "- Thompson sampling uses independent Beta(1,1) priors.\n",
      "\n",
      "Limitations:\n",
      "- Known means are a teaching oracle, usually unavailable in deployed logs.\n",
      "- One seed is not a policy-performance estimate.\n",
      "- Information value is not identical to cumulative regret.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "chapter = 11\n",
    "inputs = {'means': [0.4, 0.7], 'rounds': 120, 'seed': 7, 'pull_cost': 0.05}\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": "e873aac7154a",
   "metadata": {},
   "source": [
    "In the default world, the optimal mean is 0.7 and the other arm's mean is 0.4. Every pull of the worse arm contributes 0.3 pseudo-regret; a pull of the best contributes zero. Therefore each policy's final regret must equal 0.3 times its worse-arm pull count, independent of realized successes.\n",
    "\n",
    "The common cost 0.05 changes net observed reward but not pseudo-regret between arms, because it applies equally to every pull. The changed world reverses which arm is optimal. Counts and trajectories can change substantially even though the mean gap stays 0.3. That is a finite exploration diagnostic, not an empirical result about real tools.\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 54.442344 210.119531  L 565.2 210.119531  L 565.2 79.520234  L 54.442344 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=\"mc818b513bf\" d=\"M 0 0  L 0 3.5  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"77.658601\" 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=\"77.658601\" y=\"224.717188\" transform=\"rotate(-0 77.658601 224.717188)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"155.69644\" 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=\"155.69644\" y=\"224.717188\" transform=\"rotate(-0 155.69644 224.717188)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"233.734279\" 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=\"233.734279\" y=\"224.717188\" transform=\"rotate(-0 233.734279 224.717188)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"311.772118\" 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=\"311.772118\" y=\"224.717188\" transform=\"rotate(-0 311.772118 224.717188)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"389.809957\" 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=\"389.809957\" y=\"224.717188\" transform=\"rotate(-0 389.809957 224.717188)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"467.847796\" 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=\"467.847796\" y=\"224.717188\" transform=\"rotate(-0 467.847796 224.717188)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"545.885635\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"545.885635\" y=\"224.717188\" transform=\"rotate(-0 545.885635 224.717188)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_8\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"309.821172\" y=\"238.717969\" transform=\"rotate(-0 309.821172 238.717969)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <path d=\"M 54.442344 204.1832  L 565.2 204.1832  \" clip-path=\"url(#p0c5afafda5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_9\">\n",
       "      <defs>\n",
       "       <path id=\"m9f4c5471d5\" d=\"M 0 0  L -3.5 0  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"204.1832\" 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=\"47.442344\" y=\"207.982028\" transform=\"rotate(-0 47.442344 207.982028)\">0.3</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <path d=\"M 54.442344 164.607655  L 565.2 164.607655  \" clip-path=\"url(#p0c5afafda5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_11\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"164.607655\" 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=\"47.442344\" y=\"168.406483\" transform=\"rotate(-0 47.442344 168.406483)\">0.4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <path d=\"M 54.442344 125.032111  L 565.2 125.032111  \" clip-path=\"url(#p0c5afafda5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_13\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"125.032111\" 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=\"47.442344\" y=\"128.830939\" transform=\"rotate(-0 47.442344 128.830939)\">0.5</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <path d=\"M 54.442344 85.456566  L 565.2 85.456566  \" clip-path=\"url(#p0c5afafda5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_15\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"85.456566\" 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=\"47.442344\" y=\"89.255394\" transform=\"rotate(-0 47.442344 89.255394)\">0.6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_13\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"25.136875\" y=\"144.819883\" transform=\"rotate(-90 25.136875 144.819883)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path d=\"M 77.658601 204.1832  L 81.560493 204.1832  L 85.462385 85.456566  L 89.364277 85.456566  L 93.266169 85.456566  L 97.168061 85.456566  L 101.069953 85.456566  L 104.971845 85.456566  L 108.873736 85.456566  L 112.775628 85.456566  L 116.67752 85.456566  L 120.579412 85.456566  L 124.481304 85.456566  L 128.383196 85.456566  L 132.285088 85.456566  L 136.18698 85.456566  L 140.088872 85.456566  L 143.990764 85.456566  L 147.892656 85.456566  L 151.794548 85.456566  L 155.69644 85.456566  L 159.598332 85.456566  L 163.500224 85.456566  L 167.402116 85.456566  L 171.304008 85.456566  L 175.2059 85.456566  L 179.107792 85.456566  L 183.009684 85.456566  L 186.911575 85.456566  L 190.813467 85.456566  L 194.715359 85.456566  L 198.617251 85.456566  L 202.519143 85.456566  L 206.421035 85.456566  L 210.322927 85.456566  L 214.224819 85.456566  L 218.126711 85.456566  L 222.028603 85.456566  L 225.930495 85.456566  L 229.832387 85.456566  L 233.734279 85.456566  L 237.636171 85.456566  L 241.538063 85.456566  L 245.439955 85.456566  L 249.341847 85.456566  L 253.243739 85.456566  L 257.145631 85.456566  L 261.047523 85.456566  L 264.949414 85.456566  L 268.851306 85.456566  L 272.753198 85.456566  L 276.65509 85.456566  L 280.556982 85.456566  L 284.458874 85.456566  L 288.360766 85.456566  L 292.262658 85.456566  L 296.16455 85.456566  L 300.066442 85.456566  L 303.968334 85.456566  L 307.870226 85.456566  L 311.772118 85.456566  L 315.67401 85.456566  L 319.575902 85.456566  L 323.477794 85.456566  L 327.379686 85.456566  L 331.281578 85.456566  L 335.18347 85.456566  L 339.085361 85.456566  L 342.987253 85.456566  L 346.889145 85.456566  L 350.791037 85.456566  L 354.692929 85.456566  L 358.594821 85.456566  L 362.496713 85.456566  L 366.398605 85.456566  L 370.300497 85.456566  L 374.202389 85.456566  L 378.104281 85.456566  L 382.006173 85.456566  L 385.908065 85.456566  L 389.809957 85.456566  L 393.711849 85.456566  L 397.613741 85.456566  L 401.515633 85.456566  L 405.417525 85.456566  L 409.319417 85.456566  L 413.221309 85.456566  L 417.1232 85.456566  L 421.025092 85.456566  L 424.926984 85.456566  L 428.828876 85.456566  L 432.730768 85.456566  L 436.63266 85.456566  L 440.534552 85.456566  L 444.436444 85.456566  L 448.338336 85.456566  L 452.240228 85.456566  L 456.14212 85.456566  L 460.044012 85.456566  L 463.945904 85.456566  L 467.847796 85.456566  L 471.749688 85.456566  L 475.65158 85.456566  L 479.553472 85.456566  L 483.455364 85.456566  L 487.357256 85.456566  L 491.259148 85.456566  L 495.161039 85.456566  L 499.062931 85.456566  L 502.964823 85.456566  L 506.866715 85.456566  L 510.768607 85.456566  L 514.670499 85.456566  L 518.572391 85.456566  L 522.474283 85.456566  L 526.376175 85.456566  L 530.278067 85.456566  L 534.179959 85.456566  L 538.081851 85.456566  L 541.983743 85.456566  \" clip-path=\"url(#p0c5afafda5)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 54.442344 210.119531  L 54.442344 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 54.442344 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_14\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"54.442344\" y=\"73.520234\" transform=\"rotate(-0 54.442344 73.520234)\">greedy pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_2\">\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 54.442344 397.198594  L 565.2 397.198594  L 565.2 266.599297  L 54.442344 266.599297  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_3\">\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"77.658601\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"77.658601\" y=\"411.79625\" transform=\"rotate(-0 77.658601 411.79625)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"155.69644\" 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=\"155.69644\" y=\"411.79625\" transform=\"rotate(-0 155.69644 411.79625)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"233.734279\" 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=\"233.734279\" y=\"411.79625\" transform=\"rotate(-0 233.734279 411.79625)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_11\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"311.772118\" 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=\"311.772118\" y=\"411.79625\" transform=\"rotate(-0 311.772118 411.79625)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_12\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"389.809957\" 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=\"389.809957\" y=\"411.79625\" transform=\"rotate(-0 389.809957 411.79625)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_13\">\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"467.847796\" 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=\"467.847796\" y=\"411.79625\" transform=\"rotate(-0 467.847796 411.79625)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_14\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"545.885635\" 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=\"545.885635\" y=\"411.79625\" transform=\"rotate(-0 545.885635 411.79625)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_22\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"309.821172\" y=\"425.797031\" transform=\"rotate(-0 309.821172 425.797031)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_4\">\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_24\">\n",
       "      <path d=\"M 54.442344 395.219817  L 565.2 395.219817  \" clip-path=\"url(#p8874b0ba38)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_25\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"395.219817\" 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=\"47.442344\" y=\"399.018645\" transform=\"rotate(-0 47.442344 399.018645)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_26\">\n",
       "      <path d=\"M 54.442344 368.83612  L 565.2 368.83612  \" clip-path=\"url(#p8874b0ba38)\" 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=\"#m9f4c5471d5\" x=\"54.442344\" y=\"368.83612\" 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=\"47.442344\" y=\"372.634948\" transform=\"rotate(-0 47.442344 372.634948)\">2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_28\">\n",
       "      <path d=\"M 54.442344 342.452424  L 565.2 342.452424  \" clip-path=\"url(#p8874b0ba38)\" 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=\"#m9f4c5471d5\" x=\"54.442344\" y=\"342.452424\" 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=\"47.442344\" y=\"346.251252\" transform=\"rotate(-0 47.442344 346.251252)\">4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_30\">\n",
       "      <path d=\"M 54.442344 316.068728  L 565.2 316.068728  \" clip-path=\"url(#p8874b0ba38)\" 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=\"#m9f4c5471d5\" x=\"54.442344\" y=\"316.068728\" 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=\"47.442344\" y=\"319.867556\" transform=\"rotate(-0 47.442344 319.867556)\">6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_32\">\n",
       "      <path d=\"M 54.442344 289.685031  L 565.2 289.685031  \" clip-path=\"url(#p8874b0ba38)\" 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=\"#m9f4c5471d5\" x=\"54.442344\" y=\"289.685031\" 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=\"47.442344\" y=\"293.483859\" transform=\"rotate(-0 47.442344 293.483859)\">8</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_28\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"34.6775\" y=\"331.898945\" transform=\"rotate(-90 34.6775 331.898945)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_34\">\n",
       "    <path d=\"M 77.658601 391.262262  L 81.560493 391.262262  L 85.462385 387.304708  L 89.364277 387.304708  L 93.266169 387.304708  L 97.168061 387.304708  L 101.069953 387.304708  L 104.971845 383.347153  L 108.873736 383.347153  L 112.775628 383.347153  L 116.67752 383.347153  L 120.579412 383.347153  L 124.481304 383.347153  L 128.383196 383.347153  L 132.285088 379.389599  L 136.18698 375.432044  L 140.088872 371.47449  L 143.990764 371.47449  L 147.892656 371.47449  L 151.794548 371.47449  L 155.69644 371.47449  L 159.598332 367.516935  L 163.500224 363.559381  L 167.402116 363.559381  L 171.304008 363.559381  L 175.2059 363.559381  L 179.107792 363.559381  L 183.009684 363.559381  L 186.911575 359.601826  L 190.813467 355.644272  L 194.715359 355.644272  L 198.617251 355.644272  L 202.519143 355.644272  L 206.421035 355.644272  L 210.322927 355.644272  L 214.224819 355.644272  L 218.126711 355.644272  L 222.028603 355.644272  L 225.930495 355.644272  L 229.832387 355.644272  L 233.734279 355.644272  L 237.636171 351.686718  L 241.538063 347.729163  L 245.439955 347.729163  L 249.341847 347.729163  L 253.243739 347.729163  L 257.145631 347.729163  L 261.047523 347.729163  L 264.949414 347.729163  L 268.851306 343.771609  L 272.753198 339.814054  L 276.65509 339.814054  L 280.556982 339.814054  L 284.458874 339.814054  L 288.360766 339.814054  L 292.262658 339.814054  L 296.16455 339.814054  L 300.066442 339.814054  L 303.968334 339.814054  L 307.870226 335.8565  L 311.772118 335.8565  L 315.67401 335.8565  L 319.575902 335.8565  L 323.477794 335.8565  L 327.379686 335.8565  L 331.281578 335.8565  L 335.18347 335.8565  L 339.085361 331.898945  L 342.987253 331.898945  L 346.889145 331.898945  L 350.791037 331.898945  L 354.692929 331.898945  L 358.594821 331.898945  L 362.496713 331.898945  L 366.398605 331.898945  L 370.300497 327.941391  L 374.202389 323.983836  L 378.104281 320.026282  L 382.006173 320.026282  L 385.908065 320.026282  L 389.809957 320.026282  L 393.711849 320.026282  L 397.613741 320.026282  L 401.515633 320.026282  L 405.417525 316.068728  L 409.319417 312.111173  L 413.221309 308.153619  L 417.1232 304.196064  L 421.025092 304.196064  L 424.926984 304.196064  L 428.828876 304.196064  L 432.730768 304.196064  L 436.63266 300.23851  L 440.534552 300.23851  L 444.436444 300.23851  L 448.338336 300.23851  L 452.240228 300.23851  L 456.14212 300.23851  L 460.044012 300.23851  L 463.945904 296.280955  L 467.847796 292.323401  L 471.749688 288.365846  L 475.65158 284.408292  L 479.553472 280.450737  L 483.455364 276.493183  L 487.357256 276.493183  L 491.259148 276.493183  L 495.161039 276.493183  L 499.062931 276.493183  L 502.964823 276.493183  L 506.866715 276.493183  L 510.768607 276.493183  L 514.670499 276.493183  L 518.572391 276.493183  L 522.474283 276.493183  L 526.376175 276.493183  L 530.278067 276.493183  L 534.179959 276.493183  L 538.081851 272.535629  L 541.983743 272.535629  \" clip-path=\"url(#p8874b0ba38)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 54.442344 397.198594  L 54.442344 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 54.442344 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_29\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"54.442344\" y=\"260.599297\" transform=\"rotate(-0 54.442344 260.599297)\">ucb pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_3\">\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 54.442344 584.277656  L 565.2 584.277656  L 565.2 453.678359  L 54.442344 453.678359  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_5\">\n",
       "    <g id=\"xtick_15\">\n",
       "     <g id=\"line2d_35\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"77.658601\" 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=\"77.658601\" y=\"598.875312\" transform=\"rotate(-0 77.658601 598.875312)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_16\">\n",
       "     <g id=\"line2d_36\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"155.69644\" 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=\"155.69644\" y=\"598.875312\" transform=\"rotate(-0 155.69644 598.875312)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_17\">\n",
       "     <g id=\"line2d_37\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"233.734279\" 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=\"233.734279\" y=\"598.875312\" transform=\"rotate(-0 233.734279 598.875312)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_18\">\n",
       "     <g id=\"line2d_38\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"311.772118\" 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=\"311.772118\" y=\"598.875312\" transform=\"rotate(-0 311.772118 598.875312)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_19\">\n",
       "     <g id=\"line2d_39\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"389.809957\" 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=\"389.809957\" y=\"598.875312\" transform=\"rotate(-0 389.809957 598.875312)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_20\">\n",
       "     <g id=\"line2d_40\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"467.847796\" 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=\"467.847796\" y=\"598.875312\" transform=\"rotate(-0 467.847796 598.875312)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_21\">\n",
       "     <g id=\"line2d_41\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mc818b513bf\" x=\"545.885635\" 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=\"545.885635\" y=\"598.875312\" transform=\"rotate(-0 545.885635 598.875312)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_37\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"309.821172\" y=\"612.876094\" transform=\"rotate(-0 309.821172 612.876094)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_6\">\n",
       "    <g id=\"ytick_10\">\n",
       "     <g id=\"line2d_42\">\n",
       "      <path d=\"M 54.442344 580.979694  L 565.2 580.979694  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_43\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"580.979694\" 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=\"47.442344\" y=\"584.778522\" transform=\"rotate(-0 47.442344 584.778522)\">0.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_11\">\n",
       "     <g id=\"line2d_44\">\n",
       "      <path d=\"M 54.442344 558.993281  L 565.2 558.993281  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_45\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"558.993281\" 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=\"47.442344\" y=\"562.792109\" transform=\"rotate(-0 47.442344 562.792109)\">2.5</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_12\">\n",
       "     <g id=\"line2d_46\">\n",
       "      <path d=\"M 54.442344 537.006867  L 565.2 537.006867  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_47\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"537.006867\" 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=\"47.442344\" y=\"540.805695\" transform=\"rotate(-0 47.442344 540.805695)\">5.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_13\">\n",
       "     <g id=\"line2d_48\">\n",
       "      <path d=\"M 54.442344 515.020453  L 565.2 515.020453  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_49\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"515.020453\" 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=\"47.442344\" y=\"518.819281\" transform=\"rotate(-0 47.442344 518.819281)\">7.5</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_14\">\n",
       "     <g id=\"line2d_50\">\n",
       "      <path d=\"M 54.442344 493.03404  L 565.2 493.03404  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_51\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"493.03404\" 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=\"47.442344\" y=\"496.832868\" transform=\"rotate(-0 47.442344 496.832868)\">10.0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_15\">\n",
       "     <g id=\"line2d_52\">\n",
       "      <path d=\"M 54.442344 471.047626  L 565.2 471.047626  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_53\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m9f4c5471d5\" x=\"54.442344\" y=\"471.047626\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_43\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: end\" x=\"47.442344\" y=\"474.846454\" transform=\"rotate(-0 47.442344 474.846454)\">12.5</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_44\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"18.774375\" y=\"518.978008\" transform=\"rotate(-90 18.774375 518.978008)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_54\">\n",
       "    <path d=\"M 77.658601 578.341325  L 81.560493 578.341325  L 85.462385 575.702955  L 89.364277 573.064585  L 93.266169 573.064585  L 97.168061 570.426216  L 101.069953 567.787846  L 104.971845 565.149476  L 108.873736 565.149476  L 112.775628 565.149476  L 116.67752 565.149476  L 120.579412 565.149476  L 124.481304 562.511107  L 128.383196 559.872737  L 132.285088 559.872737  L 136.18698 557.234368  L 140.088872 557.234368  L 143.990764 557.234368  L 147.892656 554.595998  L 151.794548 554.595998  L 155.69644 554.595998  L 159.598332 554.595998  L 163.500224 554.595998  L 167.402116 551.957628  L 171.304008 551.957628  L 175.2059 551.957628  L 179.107792 549.319259  L 183.009684 546.680889  L 186.911575 544.042519  L 190.813467 541.40415  L 194.715359 538.76578  L 198.617251 536.12741  L 202.519143 533.489041  L 206.421035 533.489041  L 210.322927 530.850671  L 214.224819 530.850671  L 218.126711 528.212302  L 222.028603 528.212302  L 225.930495 528.212302  L 229.832387 528.212302  L 233.734279 525.573932  L 237.636171 525.573932  L 241.538063 525.573932  L 245.439955 522.935562  L 249.341847 522.935562  L 253.243739 522.935562  L 257.145631 522.935562  L 261.047523 520.297193  L 264.949414 520.297193  L 268.851306 520.297193  L 272.753198 517.658823  L 276.65509 517.658823  L 280.556982 517.658823  L 284.458874 515.020453  L 288.360766 512.382084  L 292.262658 509.743714  L 296.16455 507.105344  L 300.066442 507.105344  L 303.968334 504.466975  L 307.870226 504.466975  L 311.772118 504.466975  L 315.67401 504.466975  L 319.575902 504.466975  L 323.477794 504.466975  L 327.379686 504.466975  L 331.281578 504.466975  L 335.18347 501.828605  L 339.085361 501.828605  L 342.987253 499.190236  L 346.889145 499.190236  L 350.791037 499.190236  L 354.692929 496.551866  L 358.594821 493.913496  L 362.496713 493.913496  L 366.398605 493.913496  L 370.300497 491.275127  L 374.202389 491.275127  L 378.104281 491.275127  L 382.006173 488.636757  L 385.908065 488.636757  L 389.809957 485.998387  L 393.711849 485.998387  L 397.613741 483.360018  L 401.515633 483.360018  L 405.417525 483.360018  L 409.319417 483.360018  L 413.221309 483.360018  L 417.1232 483.360018  L 421.025092 483.360018  L 424.926984 483.360018  L 428.828876 483.360018  L 432.730768 483.360018  L 436.63266 483.360018  L 440.534552 483.360018  L 444.436444 483.360018  L 448.338336 483.360018  L 452.240228 483.360018  L 456.14212 483.360018  L 460.044012 480.721648  L 463.945904 478.083278  L 467.847796 478.083278  L 471.749688 478.083278  L 475.65158 478.083278  L 479.553472 478.083278  L 483.455364 475.444909  L 487.357256 472.806539  L 491.259148 472.806539  L 495.161039 470.16817  L 499.062931 470.16817  L 502.964823 470.16817  L 506.866715 467.5298  L 510.768607 467.5298  L 514.670499 467.5298  L 518.572391 467.5298  L 522.474283 464.89143  L 526.376175 462.253061  L 530.278067 462.253061  L 534.179959 459.614691  L 538.081851 459.614691  L 541.983743 459.614691  \" clip-path=\"url(#p2b5bbd79d5)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 54.442344 584.277656  L 54.442344 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 54.442344 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_45\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"54.442344\" y=\"447.678359\" transform=\"rotate(-0 54.442344 447.678359)\">thompson pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"text_46\">\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 11: bounded exploration</text>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p0c5afafda5\">\n",
       "   <rect x=\"54.442344\" y=\"79.520234\" width=\"510.757656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p8874b0ba38\">\n",
       "   <rect x=\"54.442344\" y=\"266.599297\" width=\"510.757656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p2b5bbd79d5\">\n",
       "   <rect x=\"54.442344\" y=\"453.678359\" width=\"510.757656\" 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": "73d4bf510e85",
   "metadata": {},
   "source": [
    "**Figure 11.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": "268e3e7a5e4f",
   "metadata": {},
   "source": [
    "## Change the assumption\n",
    "\n",
    "Stationarity is a central assumption. If an arm's success probability changes with time, task type, or another agent's behavior, the single mean no longer describes the process. A policy can then look stubborn because its accumulated evidence belongs to a different world.\n",
    "\n",
    "The seeded comparison also does not provide a confidence interval for policy performance. Policies consume random numbers differently, especially Thompson sampling, so the same seed is a reproducibility device rather than perfectly matched outcome exposure. Use repeated independently declared seeds and a suitable comparison design for statistical claims.\n",
    "\n",
    "A simulator oracle is not a deployed capability. Real logs usually do not reveal the true means needed for pseudo-regret. When those means are unavailable, report observed reward and an evaluation design instead of treating empirical averages as known truths."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "3679996c16c5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 11: bounded-exploration\n",
      "How much does a finite exploration policy pay to learn which action is better?\n",
      "Evidence: constructed changed-assumption example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"policies\": {\n",
      "    \"greedy\": {\n",
      "      \"counts\": [\n",
      "        110,\n",
      "        10\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        81,\n",
      "        7\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 3.0,\n",
      "      \"net_observed_reward\": 82.0,\n",
      "      \"posterior_means\": [\n",
      "        0.7321428571,\n",
      "        0.6666666667\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    },\n",
      "    \"ucb\": {\n",
      "      \"counts\": [\n",
      "        95,\n",
      "        25\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        71,\n",
      "        11\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 7.5,\n",
      "      \"net_observed_reward\": 76.0,\n",
      "      \"posterior_means\": [\n",
      "        0.7422680412,\n",
      "        0.4444444444\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    },\n",
      "    \"thompson\": {\n",
      "      \"counts\": [\n",
      "        109,\n",
      "        11\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        78,\n",
      "        6\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 3.3,\n",
      "      \"net_observed_reward\": 78.0,\n",
      "      \"posterior_means\": [\n",
      "        0.7117117117,\n",
      "        0.5384615385\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.05,\n",
      "        -0.05\n",
      "      ]\n",
      "    }\n",
      "  },\n",
      "  \"oracle_mean\": 0.7,\n",
      "  \"seed\": 7\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Pseudo-regret uses known constructed means, whereas realized reward comes from seeded Bernoulli draws. Posterior sampling draws a belief; it does not certify an arm.\n",
      "\n",
      "Assumptions:\n",
      "- Stationary independent Bernoulli rewards within each arm.\n",
      "- All policies initialize each arm once when the budget permits.\n",
      "- Thompson sampling uses independent Beta(1,1) priors.\n",
      "\n",
      "Limitations:\n",
      "- Known means are a teaching oracle, usually unavailable in deployed logs.\n",
      "- One seed is not a policy-performance estimate.\n",
      "- Information value is not identical to cumulative regret.\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 47.962344 210.119531  L 565.2 210.119531  L 565.2 79.520234  L 47.962344 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=\"mac4e5927c2\" d=\"M 0 0  L 0 3.5  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"71.473146\" 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=\"71.473146\" y=\"224.717188\" transform=\"rotate(-0 71.473146 224.717188)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"150.501054\" 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=\"150.501054\" y=\"224.717188\" transform=\"rotate(-0 150.501054 224.717188)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"229.528962\" 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=\"229.528962\" y=\"224.717188\" transform=\"rotate(-0 229.528962 224.717188)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"308.55687\" 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=\"308.55687\" y=\"224.717188\" transform=\"rotate(-0 308.55687 224.717188)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"387.584777\" 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=\"387.584777\" y=\"224.717188\" transform=\"rotate(-0 387.584777 224.717188)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_6\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"466.612685\" 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=\"466.612685\" y=\"224.717188\" transform=\"rotate(-0 466.612685 224.717188)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_7\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"545.640593\" y=\"210.119531\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"545.640593\" y=\"224.717188\" transform=\"rotate(-0 545.640593 224.717188)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_8\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"306.581172\" y=\"238.717969\" transform=\"rotate(-0 306.581172 238.717969)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_8\">\n",
       "      <path d=\"M 47.962344 204.1832  L 565.2 204.1832  \" clip-path=\"url(#p4b19879184)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_9\">\n",
       "      <defs>\n",
       "       <path id=\"m426de0f93c\" d=\"M 0 0  L -3.5 0  \" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"204.1832\" 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=\"40.962344\" y=\"207.982028\" transform=\"rotate(-0 40.962344 207.982028)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_10\">\n",
       "      <path d=\"M 47.962344 164.607655  L 565.2 164.607655  \" clip-path=\"url(#p4b19879184)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_11\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"164.607655\" 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=\"40.962344\" y=\"168.406483\" transform=\"rotate(-0 40.962344 168.406483)\">1</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_12\">\n",
       "      <path d=\"M 47.962344 125.032111  L 565.2 125.032111  \" clip-path=\"url(#p4b19879184)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_13\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"125.032111\" 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=\"40.962344\" y=\"128.830939\" transform=\"rotate(-0 40.962344 128.830939)\">2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_14\">\n",
       "      <path d=\"M 47.962344 85.456566  L 565.2 85.456566  \" clip-path=\"url(#p4b19879184)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_15\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"85.456566\" 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=\"40.962344\" y=\"89.255394\" transform=\"rotate(-0 40.962344 89.255394)\">3</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_13\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"28.1975\" y=\"144.819883\" transform=\"rotate(-90 28.1975 144.819883)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path d=\"M 71.473146 204.1832  L 75.424542 192.310536  L 79.375937 192.310536  L 83.327332 192.310536  L 87.278728 192.310536  L 91.230123 192.310536  L 95.181519 192.310536  L 99.132914 192.310536  L 103.084309 192.310536  L 107.035705 192.310536  L 110.9871 192.310536  L 114.938496 192.310536  L 118.889891 192.310536  L 122.841286 192.310536  L 126.792682 180.437873  L 130.744077 168.56521  L 134.695473 156.692546  L 138.646868 156.692546  L 142.598263 156.692546  L 146.549659 156.692546  L 150.501054 156.692546  L 154.452449 156.692546  L 158.403845 156.692546  L 162.35524 156.692546  L 166.306636 156.692546  L 170.258031 156.692546  L 174.209426 156.692546  L 178.160822 156.692546  L 182.112217 156.692546  L 186.063613 156.692546  L 190.015008 156.692546  L 193.966403 156.692546  L 197.917799 156.692546  L 201.869194 156.692546  L 205.820589 156.692546  L 209.771985 156.692546  L 213.72338 156.692546  L 217.674776 156.692546  L 221.626171 156.692546  L 225.577566 156.692546  L 229.528962 156.692546  L 233.480357 156.692546  L 237.431753 156.692546  L 241.383148 156.692546  L 245.334543 156.692546  L 249.285939 156.692546  L 253.237334 156.692546  L 257.18873 156.692546  L 261.140125 156.692546  L 265.09152 156.692546  L 269.042916 156.692546  L 272.994311 156.692546  L 276.945706 156.692546  L 280.897102 156.692546  L 284.848497 156.692546  L 288.799893 156.692546  L 292.751288 156.692546  L 296.702683 156.692546  L 300.654079 156.692546  L 304.605474 156.692546  L 308.55687 156.692546  L 312.508265 156.692546  L 316.45966 156.692546  L 320.411056 156.692546  L 324.362451 156.692546  L 328.313847 156.692546  L 332.265242 156.692546  L 336.216637 156.692546  L 340.168033 156.692546  L 344.119428 156.692546  L 348.070823 156.692546  L 352.022219 156.692546  L 355.973614 156.692546  L 359.92501 156.692546  L 363.876405 156.692546  L 367.8278 156.692546  L 371.779196 156.692546  L 375.730591 156.692546  L 379.681987 156.692546  L 383.633382 156.692546  L 387.584777 156.692546  L 391.536173 156.692546  L 395.487568 156.692546  L 399.438963 156.692546  L 403.390359 156.692546  L 407.341754 156.692546  L 411.29315 156.692546  L 415.244545 156.692546  L 419.19594 156.692546  L 423.147336 156.692546  L 427.098731 156.692546  L 431.050127 156.692546  L 435.001522 156.692546  L 438.952917 156.692546  L 442.904313 156.692546  L 446.855708 156.692546  L 450.807104 156.692546  L 454.758499 156.692546  L 458.709894 156.692546  L 462.66129 144.819883  L 466.612685 132.947219  L 470.56408 121.074556  L 474.515476 109.201893  L 478.466871 97.329229  L 482.418267 85.456566  L 486.369662 85.456566  L 490.321057 85.456566  L 494.272453 85.456566  L 498.223848 85.456566  L 502.175244 85.456566  L 506.126639 85.456566  L 510.078034 85.456566  L 514.02943 85.456566  L 517.980825 85.456566  L 521.932221 85.456566  L 525.883616 85.456566  L 529.835011 85.456566  L 533.786407 85.456566  L 537.737802 85.456566  L 541.689197 85.456566  \" clip-path=\"url(#p4b19879184)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 47.962344 210.119531  L 47.962344 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 47.962344 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_14\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"47.962344\" y=\"73.520234\" transform=\"rotate(-0 47.962344 73.520234)\">greedy pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_2\">\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 47.962344 397.198594  L 565.2 397.198594  L 565.2 266.599297  L 47.962344 266.599297  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_3\">\n",
       "    <g id=\"xtick_8\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"71.473146\" y=\"397.198594\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_15\">\n",
       "      <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"71.473146\" y=\"411.79625\" transform=\"rotate(-0 71.473146 411.79625)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_9\">\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"150.501054\" 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=\"150.501054\" y=\"411.79625\" transform=\"rotate(-0 150.501054 411.79625)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_10\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"229.528962\" 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=\"229.528962\" y=\"411.79625\" transform=\"rotate(-0 229.528962 411.79625)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_11\">\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"308.55687\" 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=\"308.55687\" y=\"411.79625\" transform=\"rotate(-0 308.55687 411.79625)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_12\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"387.584777\" 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=\"387.584777\" y=\"411.79625\" transform=\"rotate(-0 387.584777 411.79625)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_13\">\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"466.612685\" 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=\"466.612685\" y=\"411.79625\" transform=\"rotate(-0 466.612685 411.79625)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_14\">\n",
       "     <g id=\"line2d_23\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"545.640593\" 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=\"545.640593\" y=\"411.79625\" transform=\"rotate(-0 545.640593 411.79625)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_22\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"306.581172\" y=\"425.797031\" transform=\"rotate(-0 306.581172 425.797031)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_4\">\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_24\">\n",
       "      <path d=\"M 47.962344 391.262262  L 565.2 391.262262  \" clip-path=\"url(#p4d8e4c10a9)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_25\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" 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=\"40.962344\" y=\"395.06109\" transform=\"rotate(-0 40.962344 395.06109)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_26\">\n",
       "      <path d=\"M 47.962344 359.601826  L 565.2 359.601826  \" clip-path=\"url(#p4d8e4c10a9)\" 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=\"#m426de0f93c\" x=\"47.962344\" y=\"359.601826\" 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=\"40.962344\" y=\"363.400655\" transform=\"rotate(-0 40.962344 363.400655)\">2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_7\">\n",
       "     <g id=\"line2d_28\">\n",
       "      <path d=\"M 47.962344 327.941391  L 565.2 327.941391  \" clip-path=\"url(#p4d8e4c10a9)\" 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=\"#m426de0f93c\" x=\"47.962344\" y=\"327.941391\" 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=\"40.962344\" y=\"331.740219\" transform=\"rotate(-0 40.962344 331.740219)\">4</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_8\">\n",
       "     <g id=\"line2d_30\">\n",
       "      <path d=\"M 47.962344 296.280955  L 565.2 296.280955  \" clip-path=\"url(#p4d8e4c10a9)\" 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=\"#m426de0f93c\" x=\"47.962344\" y=\"296.280955\" 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=\"40.962344\" y=\"300.079783\" transform=\"rotate(-0 40.962344 300.079783)\">6</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_27\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"28.1975\" y=\"331.898945\" transform=\"rotate(-90 28.1975 331.898945)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_32\">\n",
       "    <path d=\"M 71.473146 391.262262  L 75.424542 386.513197  L 79.375937 386.513197  L 83.327332 381.764131  L 87.278728 381.764131  L 91.230123 377.015066  L 95.181519 377.015066  L 99.132914 372.266001  L 103.084309 372.266001  L 107.035705 372.266001  L 110.9871 372.266001  L 114.938496 367.516935  L 118.889891 367.516935  L 122.841286 362.76787  L 126.792682 362.76787  L 130.744077 362.76787  L 134.695473 362.76787  L 138.646868 362.76787  L 142.598263 358.018805  L 146.549659 358.018805  L 150.501054 358.018805  L 154.452449 358.018805  L 158.403845 353.269739  L 162.35524 353.269739  L 166.306636 353.269739  L 170.258031 353.269739  L 174.209426 353.269739  L 178.160822 353.269739  L 182.112217 353.269739  L 186.063613 353.269739  L 190.015008 348.520674  L 193.966403 348.520674  L 197.917799 348.520674  L 201.869194 348.520674  L 205.820589 348.520674  L 209.771985 348.520674  L 213.72338 348.520674  L 217.674776 348.520674  L 221.626171 348.520674  L 225.577566 348.520674  L 229.528962 348.520674  L 233.480357 348.520674  L 237.431753 348.520674  L 241.383148 343.771609  L 245.334543 343.771609  L 249.285939 343.771609  L 253.237334 343.771609  L 257.18873 343.771609  L 261.140125 343.771609  L 265.09152 343.771609  L 269.042916 343.771609  L 272.994311 339.022543  L 276.945706 334.273478  L 280.897102 334.273478  L 284.848497 334.273478  L 288.799893 334.273478  L 292.751288 334.273478  L 296.702683 334.273478  L 300.654079 334.273478  L 304.605474 329.524413  L 308.55687 329.524413  L 312.508265 329.524413  L 316.45966 329.524413  L 320.411056 329.524413  L 324.362451 329.524413  L 328.313847 329.524413  L 332.265242 329.524413  L 336.216637 329.524413  L 340.168033 324.775347  L 344.119428 324.775347  L 348.070823 324.775347  L 352.022219 324.775347  L 355.973614 324.775347  L 359.92501 324.775347  L 363.876405 324.775347  L 367.8278 320.026282  L 371.779196 315.277217  L 375.730591 310.528151  L 379.681987 310.528151  L 383.633382 310.528151  L 387.584777 310.528151  L 391.536173 310.528151  L 395.487568 310.528151  L 399.438963 310.528151  L 403.390359 305.779086  L 407.341754 301.030021  L 411.29315 296.280955  L 415.244545 291.53189  L 419.19594 286.782825  L 423.147336 282.033759  L 427.098731 282.033759  L 431.050127 282.033759  L 435.001522 282.033759  L 438.952917 277.284694  L 442.904313 277.284694  L 446.855708 277.284694  L 450.807104 277.284694  L 454.758499 277.284694  L 458.709894 277.284694  L 462.66129 277.284694  L 466.612685 277.284694  L 470.56408 277.284694  L 474.515476 277.284694  L 478.466871 277.284694  L 482.418267 277.284694  L 486.369662 277.284694  L 490.321057 277.284694  L 494.272453 277.284694  L 498.223848 277.284694  L 502.175244 277.284694  L 506.126639 277.284694  L 510.078034 277.284694  L 514.02943 277.284694  L 517.980825 277.284694  L 521.932221 277.284694  L 525.883616 277.284694  L 529.835011 277.284694  L 533.786407 272.535629  L 537.737802 272.535629  L 541.689197 272.535629  \" clip-path=\"url(#p4d8e4c10a9)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 47.962344 397.198594  L 47.962344 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 47.962344 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=\"47.962344\" y=\"260.599297\" transform=\"rotate(-0 47.962344 260.599297)\">ucb pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"axes_3\">\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 47.962344 584.277656  L 565.2 584.277656  L 565.2 453.678359  L 47.962344 453.678359  z \" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_5\">\n",
       "    <g id=\"xtick_15\">\n",
       "     <g id=\"line2d_33\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"71.473146\" 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=\"71.473146\" y=\"598.875312\" transform=\"rotate(-0 71.473146 598.875312)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_16\">\n",
       "     <g id=\"line2d_34\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"150.501054\" 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=\"150.501054\" y=\"598.875312\" transform=\"rotate(-0 150.501054 598.875312)\">20</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_17\">\n",
       "     <g id=\"line2d_35\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"229.528962\" 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=\"229.528962\" y=\"598.875312\" transform=\"rotate(-0 229.528962 598.875312)\">40</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_18\">\n",
       "     <g id=\"line2d_36\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"308.55687\" 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=\"308.55687\" y=\"598.875312\" transform=\"rotate(-0 308.55687 598.875312)\">60</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_19\">\n",
       "     <g id=\"line2d_37\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"387.584777\" 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=\"387.584777\" y=\"598.875312\" transform=\"rotate(-0 387.584777 598.875312)\">80</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_20\">\n",
       "     <g id=\"line2d_38\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"466.612685\" 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=\"466.612685\" y=\"598.875312\" transform=\"rotate(-0 466.612685 598.875312)\">100</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_21\">\n",
       "     <g id=\"line2d_39\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mac4e5927c2\" x=\"545.640593\" 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=\"545.640593\" y=\"598.875312\" transform=\"rotate(-0 545.640593 598.875312)\">120</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_36\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"306.581172\" y=\"612.876094\" transform=\"rotate(-0 306.581172 612.876094)\">round</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_6\">\n",
       "    <g id=\"ytick_9\">\n",
       "     <g id=\"line2d_40\">\n",
       "      <path d=\"M 47.962344 578.341325  L 565.2 578.341325  \" clip-path=\"url(#p93f333cdef)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_41\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"578.341325\" 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=\"40.962344\" y=\"582.140153\" transform=\"rotate(-0 40.962344 582.140153)\">0</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_10\">\n",
       "     <g id=\"line2d_42\">\n",
       "      <path d=\"M 47.962344 542.363557  L 565.2 542.363557  \" clip-path=\"url(#p93f333cdef)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_43\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"542.363557\" 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=\"40.962344\" y=\"546.162385\" transform=\"rotate(-0 40.962344 546.162385)\">1</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_11\">\n",
       "     <g id=\"line2d_44\">\n",
       "      <path d=\"M 47.962344 506.385789  L 565.2 506.385789  \" clip-path=\"url(#p93f333cdef)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_45\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"506.385789\" 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=\"40.962344\" y=\"510.184617\" transform=\"rotate(-0 40.962344 510.184617)\">2</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_12\">\n",
       "     <g id=\"line2d_46\">\n",
       "      <path d=\"M 47.962344 470.408021  L 565.2 470.408021  \" clip-path=\"url(#p93f333cdef)\" style=\"fill: none; stroke: #d4d8da; stroke-width: 0.6; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_47\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m426de0f93c\" x=\"47.962344\" y=\"470.408021\" 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=\"40.962344\" y=\"474.206849\" transform=\"rotate(-0 40.962344 474.206849)\">3</text>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_41\">\n",
       "     <text style=\"font-size: 10px; font-family: 'DejaVu Sans'; text-anchor: middle\" x=\"28.1975\" y=\"518.978008\" transform=\"rotate(-90 28.1975 518.978008)\">expected reward shortfall</text>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_48\">\n",
       "    <path d=\"M 71.473146 578.341325  L 75.424542 567.547994  L 79.375937 567.547994  L 83.327332 567.547994  L 87.278728 556.754664  L 91.230123 556.754664  L 95.181519 556.754664  L 99.132914 556.754664  L 103.084309 556.754664  L 107.035705 556.754664  L 110.9871 556.754664  L 114.938496 556.754664  L 118.889891 556.754664  L 122.841286 556.754664  L 126.792682 556.754664  L 130.744077 556.754664  L 134.695473 556.754664  L 138.646868 556.754664  L 142.598263 556.754664  L 146.549659 556.754664  L 150.501054 556.754664  L 154.452449 556.754664  L 158.403845 545.961334  L 162.35524 535.168003  L 166.306636 535.168003  L 170.258031 535.168003  L 174.209426 524.374673  L 178.160822 524.374673  L 182.112217 524.374673  L 186.063613 524.374673  L 190.015008 524.374673  L 193.966403 524.374673  L 197.917799 524.374673  L 201.869194 524.374673  L 205.820589 524.374673  L 209.771985 524.374673  L 213.72338 524.374673  L 217.674776 524.374673  L 221.626171 524.374673  L 225.577566 524.374673  L 229.528962 524.374673  L 233.480357 524.374673  L 237.431753 524.374673  L 241.383148 524.374673  L 245.334543 524.374673  L 249.285939 524.374673  L 253.237334 524.374673  L 257.18873 524.374673  L 261.140125 524.374673  L 265.09152 524.374673  L 269.042916 524.374673  L 272.994311 524.374673  L 276.945706 524.374673  L 280.897102 524.374673  L 284.848497 524.374673  L 288.799893 524.374673  L 292.751288 524.374673  L 296.702683 524.374673  L 300.654079 524.374673  L 304.605474 524.374673  L 308.55687 524.374673  L 312.508265 524.374673  L 316.45966 524.374673  L 320.411056 524.374673  L 324.362451 524.374673  L 328.313847 524.374673  L 332.265242 524.374673  L 336.216637 524.374673  L 340.168033 524.374673  L 344.119428 524.374673  L 348.070823 524.374673  L 352.022219 524.374673  L 355.973614 524.374673  L 359.92501 524.374673  L 363.876405 524.374673  L 367.8278 524.374673  L 371.779196 524.374673  L 375.730591 524.374673  L 379.681987 524.374673  L 383.633382 524.374673  L 387.584777 524.374673  L 391.536173 524.374673  L 395.487568 524.374673  L 399.438963 524.374673  L 403.390359 524.374673  L 407.341754 524.374673  L 411.29315 524.374673  L 415.244545 524.374673  L 419.19594 524.374673  L 423.147336 524.374673  L 427.098731 524.374673  L 431.050127 524.374673  L 435.001522 524.374673  L 438.952917 524.374673  L 442.904313 524.374673  L 446.855708 524.374673  L 450.807104 513.581343  L 454.758499 513.581343  L 458.709894 513.581343  L 462.66129 502.788012  L 466.612685 502.788012  L 470.56408 502.788012  L 474.515476 491.994682  L 478.466871 491.994682  L 482.418267 491.994682  L 486.369662 491.994682  L 490.321057 491.994682  L 494.272453 491.994682  L 498.223848 491.994682  L 502.175244 481.201352  L 506.126639 481.201352  L 510.078034 481.201352  L 514.02943 481.201352  L 517.980825 481.201352  L 521.932221 481.201352  L 525.883616 481.201352  L 529.835011 470.408021  L 533.786407 459.614691  L 537.737802 459.614691  L 541.689197 459.614691  \" clip-path=\"url(#p93f333cdef)\" style=\"fill: none; stroke: #31586b; stroke-width: 1.8; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 47.962344 584.277656  L 47.962344 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 47.962344 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_42\">\n",
       "    <text style=\"font-size: 11px; font-family: 'DejaVu Sans'; text-anchor: start\" x=\"47.962344\" y=\"447.678359\" transform=\"rotate(-0 47.962344 447.678359)\">thompson pseudo-regret</text>\n",
       "   </g>\n",
       "  </g>\n",
       "  <g id=\"text_43\">\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 11: bounded exploration</text>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p4b19879184\">\n",
       "   <rect x=\"47.962344\" y=\"79.520234\" width=\"517.237656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p4d8e4c10a9\">\n",
       "   <rect x=\"47.962344\" y=\"266.599297\" width=\"517.237656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       "  <clipPath id=\"p93f333cdef\">\n",
       "   <rect x=\"47.962344\" y=\"453.678359\" width=\"517.237656\" height=\"130.599297\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "changed_inputs = {'means': [0.7, 0.4], 'rounds': 120, 'seed': 7, 'pull_cost': 0.05}\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": "076246d1d06d",
   "metadata": {},
   "source": [
    "**Figure 11.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": "a0c129e06554",
   "metadata": {},
   "source": [
    "## Try a new case\n",
    "\n",
    "The transfer problem has three arms, with gaps 0.6,0.3,0 relative to the best mean 0.8. Its pseudo-regret must equal 0.6 n_0+0.3 n_1. Check that identity against each returned count vector.\n",
    "\n",
    "For a local exploration plan, specify budget, outcome predicate, arm availability, and the evidence supporting stationarity. Different tool costs require an extended objective rather than the equal-cost comparison here. Keep exploration expense separate from any proposed value-of-information calculation. If the real task asks whether one extra observation is worthwhile, use the belief and information method rather than relabeling regret."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "faf3768d8974",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 11: bounded-exploration\n",
      "How much does a finite exploration policy pay to learn which action is better?\n",
      "Evidence: constructed transfer example\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"policies\": {\n",
      "    \"greedy\": {\n",
      "      \"counts\": [\n",
      "        1,\n",
      "        1,\n",
      "        88\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        0,\n",
      "        0,\n",
      "        78\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 0.9,\n",
      "      \"net_observed_reward\": 69.0,\n",
      "      \"posterior_means\": [\n",
      "        0.3333333333,\n",
      "        0.3333333333,\n",
      "        0.8777777778\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    },\n",
      "    \"ucb\": {\n",
      "      \"counts\": [\n",
      "        9,\n",
      "        25,\n",
      "        56\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        2,\n",
      "        16,\n",
      "        48\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 12.9,\n",
      "      \"net_observed_reward\": 57.0,\n",
      "      \"posterior_means\": [\n",
      "        0.2727272727,\n",
      "        0.6296296296,\n",
      "        0.8448275862\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    },\n",
      "    \"thompson\": {\n",
      "      \"counts\": [\n",
      "        2,\n",
      "        2,\n",
      "        86\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        0,\n",
      "        0,\n",
      "        71\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 1.8,\n",
      "      \"net_observed_reward\": 62.0,\n",
      "      \"posterior_means\": [\n",
      "        0.25,\n",
      "        0.25,\n",
      "        0.8181818182\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    }\n",
      "  },\n",
      "  \"oracle_mean\": 0.8,\n",
      "  \"seed\": 19\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Pseudo-regret uses known constructed means, whereas realized reward comes from seeded Bernoulli draws. Posterior sampling draws a belief; it does not certify an arm.\n",
      "\n",
      "Assumptions:\n",
      "- Stationary independent Bernoulli rewards within each arm.\n",
      "- All policies initialize each arm once when the budget permits.\n",
      "- Thompson sampling uses independent Beta(1,1) priors.\n",
      "\n",
      "Limitations:\n",
      "- Known means are a teaching oracle, usually unavailable in deployed logs.\n",
      "- One seed is not a policy-performance estimate.\n",
      "- Information value is not identical to cumulative regret.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "transfer_inputs = {'means': [0.2, 0.5, 0.8], 'rounds': 90, 'seed': 19, 'pull_cost': 0.1}\n",
    "transfer = analyze(chapter, transfer_inputs)\n",
    "transfer['evidence_kind'] = 'constructed transfer example'\n",
    "print(report_text(transfer))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43addf980f13",
   "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",
    "- **means:** Arm success probabilities in [0,1], known only to this constructed simulator.\n",
    "- **rounds:** Integer pull budget 1..10000.\n",
    "- **seed:** Nonnegative integer random seed.\n",
    "- **pull_cost:** Nonnegative common cost per pull."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "36e81e509345",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Chapter 11: bounded-exploration\n",
      "How much does a finite exploration policy pay to learn which action is better?\n",
      "Evidence: supplied local inputs; provenance not independently verified\n",
      "\n",
      "Calculated quantities:\n",
      "{\n",
      "  \"policies\": {\n",
      "    \"greedy\": {\n",
      "      \"counts\": [\n",
      "        1,\n",
      "        1,\n",
      "        88\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        0,\n",
      "        0,\n",
      "        78\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 0.9,\n",
      "      \"net_observed_reward\": 69.0,\n",
      "      \"posterior_means\": [\n",
      "        0.3333333333,\n",
      "        0.3333333333,\n",
      "        0.8777777778\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    },\n",
      "    \"ucb\": {\n",
      "      \"counts\": [\n",
      "        9,\n",
      "        25,\n",
      "        56\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        2,\n",
      "        16,\n",
      "        48\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 12.9,\n",
      "      \"net_observed_reward\": 57.0,\n",
      "      \"posterior_means\": [\n",
      "        0.2727272727,\n",
      "        0.6296296296,\n",
      "        0.8448275862\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    },\n",
      "    \"thompson\": {\n",
      "      \"counts\": [\n",
      "        2,\n",
      "        2,\n",
      "        86\n",
      "      ],\n",
      "      \"successes\": [\n",
      "        0,\n",
      "        0,\n",
      "        71\n",
      "      ],\n",
      "      \"cumulative_pseudo_regret\": 1.8,\n",
      "      \"net_observed_reward\": 62.0,\n",
      "      \"posterior_means\": [\n",
      "        0.25,\n",
      "        0.25,\n",
      "        0.8181818182\n",
      "      ],\n",
      "      \"one_pull_gross_information_value\": [\n",
      "        0.0,\n",
      "        0.0,\n",
      "        0.0\n",
      "      ],\n",
      "      \"one_pull_net_information_value\": [\n",
      "        -0.1,\n",
      "        -0.1,\n",
      "        -0.1\n",
      "      ]\n",
      "    }\n",
      "  },\n",
      "  \"oracle_mean\": 0.8,\n",
      "  \"seed\": 19\n",
      "}\n",
      "\n",
      "Interpretation:\n",
      "Pseudo-regret uses known constructed means, whereas realized reward comes from seeded Bernoulli draws. Posterior sampling draws a belief; it does not certify an arm.\n",
      "\n",
      "Assumptions:\n",
      "- Stationary independent Bernoulli rewards within each arm.\n",
      "- All policies initialize each arm once when the budget permits.\n",
      "- Thompson sampling uses independent Beta(1,1) priors.\n",
      "\n",
      "Limitations:\n",
      "- Known means are a teaching oracle, usually unavailable in deployed logs.\n",
      "- One seed is not a policy-performance estimate.\n",
      "- Information value is not identical to cumulative regret.\n",
      "\n",
      "Execution: completed locally; constructed inputs are not deployment measurements.\n"
     ]
    }
   ],
   "source": [
    "reader_file = LAB_ROOT / 'data/examples/ch11.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": "e7df68bb3912",
   "metadata": {},
   "source": [
    "## Questions\n",
    "\n",
    "1. Express default regret through counts.\n",
    "\n",
    "2. Does common pull cost change arm pseudo-regret?\n",
    "\n",
    "3. Express transfer regret.\n",
    "\n",
    "Answers: [separate solutions](../solutions/ch11.md). Try the calculation before opening them."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "64696700ca6c",
   "metadata": {},
   "source": [
    "## Summary\n",
    "\n",
    "Greedy, UCB, and posterior sampling make different finite exploration choices. The notebook separates known-mean pseudo-regret from realized net reward and records the seed and pull counts. Swapped means and a three-arm transfer case test the calculation. Its conclusions are conditional on stationary independent Bernoulli rewards. A favorable run does not demonstrate universal policy superiority, and known simulator means must not be mistaken for calibrated deployed-tool estimates.\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-11-bounded-exploration`](../skills/maa-11-bounded-exploration/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": "aff6686d5462",
   "metadata": {},
   "source": [
    "### Equation 11.1\n",
    "\n",
    "![Equation 11.1](../assets/math/0748ee3073daf997794a.svg)\n",
    "\n",
    "Equation (11.1) measures the total payoff an agent gave up over its run by not always taking the action it would have taken had it known which was best.\n",
    "\n",
    "Multiply the best action's mean payoff by the number of rounds, then subtract the average total the agent actually collected.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "\\operatorname{Reg}(T)=T\\mu^{\\star}-\\operatorname{E}\\!\\left[\\sum_{t=0}^{T-1}\\mu_{a_t}\\right].\n",
    "\\tag{11.1}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1093429cf265",
   "metadata": {},
   "source": [
    "### Equation 11.2\n",
    "\n",
    "![Equation 11.2](../assets/math/b25daa0c3c98ef2794a7.svg)\n",
    "\n",
    "Equation (11.2) ranks actions by an optimistic estimate rather than a best guess, so an action stays in contention while it remains poorly understood.\n",
    "\n",
    "Add to each action's average payoff a bonus that grows as the run lengthens and shrinks as that action is tried more often, then take the largest sum.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "a_t=\\arg\\max_{a\\in\\mathcal{A}}\\left(\\hat\\mu_a+c\\sqrt{\\frac{\\ln t}{N_t(a)}}\\right).\n",
    "\\tag{11.2}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "740521e5b5c5",
   "metadata": {},
   "source": [
    "### Equation 11.3\n",
    "\n",
    "![Equation 11.3](../assets/math/638761b25c1352586c4f.svg)\n",
    "\n",
    "Equation (11.3) measures how much a candidate observation would reduce uncertainty about the specific quantity a decision depends on, rather than about anything at all.\n",
    "\n",
    "Subtract the uncertainty remaining about the decision-relevant quantity after the observation from the uncertainty before it.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "\\operatorname{Gain}(O)=I(Y;O)=H(Y)-H(Y\\mid O).\n",
    "\\tag{11.3}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd9c2034eacb",
   "metadata": {},
   "source": [
    "### Equation 11.4\n",
    "\n",
    "![Equation 11.4](../assets/math/f9f2ae99c3d3c2206ea0.svg)\n",
    "\n",
    "Equation (11.4) prices an observation by comparing the best the agent could do knowing it against the best it can do without it.\n",
    "\n",
    "Take the average, over possible observations, of the best expected utility available after seeing each one, then subtract the best expected utility available now.\n",
    "\n",
    "LaTeX source, preserved for inspection:\n",
    "\n",
    "```latex\n",
    "\\operatorname{VOI}(O)=\\operatorname{E}_{O}\\!\\left[\\max_{a}\\operatorname{EU}(a\\mid O)\\right]-\\max_{a}\\operatorname{EU}(a).\n",
    "\\tag{11.4}\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Mathematics of AI Agents",
   "language": "python",
   "name": "maa-lab"
  },
  "lab_chapter": 11,
  "lab_execution": {
   "code_cells": 6,
   "created_utc": "2026-10-02T05:14:33.444758+00:00",
   "elapsed_seconds": 8.972154707997106,
   "method": "fresh process; new ipykernel InProcessKernelManager; cells submitted as Jupyter execute requests",
   "network_transport_tested": false,
   "python": "3.11.15",
   "source_sha256": "9078eef62a8041b3b75364e91f29eecbb25b08974d7fb8fc897f57d16d1752b4"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
