{
 "nbformat": 4,
 "nbformat_minor": 5,
 "metadata": {
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3",
   "language": "python"
  },
  "language_info": {
   "name": "python"
  },
  "colab": {
   "name": "sqerrloss.ipynb"
  }
 },
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "# squared error loss \u2014 Python demo\n\nNumerical companion to the entry [squared error loss](https://dictionaryofml.org/terms/sqerrloss.html) of the [Dictionary of Applied Machine Learning](https://dictionaryofml.org/): it recomputes what the entry states and prints one line per check.\n\nNumerical companion to the glossary entry 'sqerrloss'. Every 18th day of 2024 at Krems, 21 days, is the training set; a day is a data point whose feature is the morning minimum temperature and whose label the maximum daytime temperature. A hypothesis h(x) = w0 + w1 x predicts the maximum, and the squared error loss of a day is the square of the difference between its label and that prediction.\n\nRequires NumPy and Matplotlib only, and uses fixed seeds, so the printed numbers reproduce exactly. Generated from [`pythondemos/sqerrloss.py`](https://dictionaryofml.org/terms/sqerrloss.py); CC BY 4.0.\n\nBefore running a downloaded copy, scan it: `uvx bandit -q -t B102,B307,B602,B605 sqerrloss.py` (B102,B307,B602,B605 are the exec, eval and shell checks of [bandit](https://bandit.readthedocs.io/)) reports nothing: the script runs no shell command and evaluates no generated code."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "# Notebook shim: the script resolves output paths relative to __file__,\n# which a notebook kernel does not define; everything lands in the\n# working directory instead.\nimport os\n__file__ = os.path.join(os.getcwd(), \"sqerrloss.py\")\nos.makedirs(\"pythondemos\", exist_ok=True)"
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "\"\"\"The squared error loss of a line that predicts the maximum daytime\ntemperature from the morning minimum at Krems an der Donau.\n\nPurpose\n-------\nNumerical companion to the glossary entry 'sqerrloss'.  Every 18th day of\n2024 at Krems, 21 days, is the training set; a day is a data point whose\nfeature is the morning minimum temperature and whose label the maximum\ndaytime temperature.  A hypothesis h(x) = w0 + w1 x predicts the maximum,\nand the squared error loss of a day is the square of the difference\nbetween its label and that prediction.\n\nThe demo checks the entry's claims: the training error of a hypothesis is\nthe average of the per-day squared error losses; the least-squares line\nsolves the normal equations and incurs a smaller average than any other\nline; the average squared error of a constant prediction is the sample\nvariance of the labels plus the squared distance of the constant from\ntheir mean, so the mean is the best constant under the squared error and\nthe median the best constant under the absolute error; the negative\nlog-likelihood of a label under Gaussian noise around h(x) is an\nincreasing affine function of the squared error loss, so least squares is\nmaximum likelihood; and a single corrupted label moves the least-squares\nline in proportion to the corruption while the least-absolute-deviation\nand the Huber line stop moving once the corrupted day is far from them.\n\nDeterministic: the training days are a fixed stride through 2024, every\nestimate is a closed form or an exact enumeration, and the Huber line is\nan iteratively reweighted least-squares fixed point.  Self-contained:\nnumpy + matplotlib only; the GeoSphere download falls back to the\ncommitted CSV.\n\nBlocks\n------\n[B-data]      Download the daily minimum and maximum temperature of 2024\n              at Krems (GeoSphere station 3805) or read the committed\n              copy; 366 days; every 18th day is the training set, 21 days.\n[B-loss]      The least-squares line, the squared error loss of each\n              training day, and their average, the training error; the\n              normal equations hold at the solution, and every other line\n              has a larger average loss.\n[B-constant]  Constant predictions: the average squared error of a constant\n              c is the sample variance of the labels plus (c - mean)^2,\n              so the sample mean is the best constant; the median is the\n              best constant under the absolute error.\n[B-gauss]     Gaussian noise: the negative log-likelihood of a label is an\n              increasing affine function of its squared error loss, so the\n              least-squares line is the maximum likelihood estimate, and\n              the training error is the maximum likelihood variance.\n[B-outlier]   One training day's label is raised by Delta = 0, ..., 30\n              degrees; the least-squares line moves in proportion to Delta\n              (the proportionality constant is the day's leverage), while\n              the least-absolute-deviation line and the Huber line stop\n              moving once the corrupted day is far from them.\n[B-plot]      CSVs for the figure and the matplotlib preview.\n\nOutputs\n-------\nsqerrloss_weather.csv      : date, tmin, tmax (committed copy).\nsqerrloss_points.csv       : the 21 training days with the least-squares\n                             prediction and the squared error loss of each.\nsqerrloss_lines.csv        : the least-squares line on a grid of mornings.\nsqerrloss_outlier.csv      : displacement of the three learned lines at\n                             the corrupted day against Delta.\nsqerrloss.png              : matplotlib preview (checking only).\n\"\"\"\n\n# /// script\n# requires-python = \">=3.10\"\n# dependencies = [\"matplotlib==3.10.7\", \"numpy==2.3.4\"]\n# ///\n\nimport json\nimport urllib.request\nfrom pathlib import Path\n\nimport numpy as np\nimport matplotlib\n\nmatplotlib.use(\"Agg\")\nimport matplotlib.pyplot as plt\n\nOUT_DIR = Path(__file__).parent\n\nreport = []\n\n\ndef check(name, ok):\n    report.append((name, bool(ok)))\n    print(f\"  [{'ok' if ok else 'FAIL'}] {name}\")"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-data]** Download the daily minimum and maximum temperature of 2024 at Krems (GeoSphere station 3805) or read the committed copy; 366 days; every 18th day is the training set, 21 days."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-data] daily minimum and maximum temperature at Krems, 2024\")\nURL = (\"https://dataset.api.hub.geosphere.at/v1/station/historical/\"\n       \"klima-v2-1d?parameters=tlmin,tlmax&station_ids=3805\"\n       \"&start=2024-01-01&end=2024-12-31\")\nCSV = OUT_DIR / \"sqerrloss_weather.csv\"\ntry:\n    with urllib.request.urlopen(URL, timeout=120) as resp:\n        payload = json.load(resp)\n    params = payload[\"features\"][0][\"properties\"][\"parameters\"]\n    records = [(stamp[:10], lo, hi)\n               for stamp, lo, hi in zip(payload[\"timestamps\"],\n                                        params[\"tlmin\"][\"data\"],\n                                        params[\"tlmax\"][\"data\"])]\n    with open(CSV, \"w\") as fh:\n        fh.write(\"date,tmin,tmax\\n\")\n        for day, lo, hi in records:\n            fh.write(f\"{day},{lo},{hi}\\n\")\n    print(f\"    downloaded {len(records)} days\")\nexcept OSError as err:\n    print(f\"    download failed ({err}); reading the committed CSV\")\n    rows = CSV.read_text().strip().splitlines()[1:]\n    records = [(d, float(a), float(b))\n               for d, a, b in (r.split(\",\") for r in rows)]\n\ncheck(\"[B-data] 366 days for 2024\", len(records) == 366)\ncheck(\"[B-data] no day is missing a temperature\",\n      all(lo is not None and hi is not None for _, lo, hi in records))\nSTRIDE = 18\nidx = np.arange(0, len(records), STRIDE)\ndates = [records[i][0] for i in idx]\nx = np.array([records[i][1] for i in idx], dtype=float)   # morning minimum\ny = np.array([records[i][2] for i in idx], dtype=float)   # daytime maximum\nm = len(x)\ncheck(f\"[B-data] every {STRIDE}th day of 2024 is a training day: {m} days, \"\n      f\"{dates[0]} to {dates[-1]}\", m == 21)\nX = np.column_stack([np.ones(m), x])   # constant feature + morning minimum\n\n\ndef line(w, x):\n    return w[0] + w[1] * x\n\n\ndef sq_loss(w, x, y):\n    \"\"\"Squared error loss of the line w on each data point.\"\"\"\n    return (y - line(w, x)) ** 2\n\n\ndef abs_loss(w, x, y):\n    return np.abs(y - line(w, x))\n\n\ndef least_squares(X, y):\n    \"\"\"The unique solution of the normal equations.\"\"\"\n    return np.linalg.solve(X.T @ X, X.T @ y)"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-loss]** The least-squares line, the squared error loss of each training day, and their average, the training error; the normal equations hold at the solution, and every other line has a larger average loss."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-loss] the least-squares line and the per-day squared error loss\")\nw_ls = least_squares(X, y)\nlosses = sq_loss(w_ls, x, y)\ntrain_err = float(losses.mean())\ncheck(f\"[B-loss] least-squares line h(x) = {w_ls[0]:.2f} + {w_ls[1]:.2f} x\",\n      w_ls[1] > 0)\nd0 = 0\ncheck(f\"[B-loss] {dates[d0]}: morning minimum {x[d0]:.1f}, maximum \"\n      f\"{y[d0]:.1f}, prediction {line(w_ls, x[d0]):.1f}, squared error \"\n      f\"loss {losses[d0]:.2f}\",\n      abs(losses[d0] - (y[d0] - line(w_ls, x[d0])) ** 2) < 1e-12)\nworst = int(np.argmax(losses))\ncheck(f\"[B-loss] largest loss {losses[worst]:.2f} on {dates[worst]} \"\n      f\"(morning minimum {x[worst]:.1f}, maximum {y[worst]:.1f}, prediction \"\n      f\"{line(w_ls, x[worst]):.2f}); \"\n      f\"smallest {losses.min():.2f}\", losses[worst] > 10 * losses.min())\ncheck(f\"[B-loss] the average of the {m} losses, the training error, is \"\n      f\"{train_err:.2f}, its square root {np.sqrt(train_err):.2f} degrees\",\n      abs(train_err - np.sum((y - X @ w_ls) ** 2) / m) < 1e-12)\nresid = y - X @ w_ls\ncheck(\"[B-loss] normal equations: the gradient of the average loss, \"\n      \"-(2/m) X^T (y - X w), vanishes at the least-squares line\",\n      np.allclose(X.T @ resid, 0.0, atol=1e-9))\nrng = np.random.default_rng(2024)\nothers = w_ls + rng.normal(size=(500, 2)) * np.array([3.0, 0.3])\ncheck(\"[B-loss] 500 other lines all have a larger average squared error \"\n      \"loss (the average loss is convex with the least-squares line as \"\n      \"its unique minimizer)\",\n      all(sq_loss(w, x, y).mean() > train_err for w in others))\ncheck(\"[B-loss] the squared error loss is unit-free up to the square: the \"\n      \"losses are measured in squared degrees, the labels in degrees\",\n      abs(np.sqrt(losses).mean() - abs_loss(w_ls, x, y).mean()) < 1e-12)"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-constant]** Constant predictions: the average squared error of a constant c is the sample variance of the labels plus (c - mean)^2, so the sample mean is the best constant; the median is the best constant under the absolute error."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-constant] constant predictions under the squared and the absolute \"\n      \"error\")\nybar, ymed = float(y.mean()), float(np.median(y))\nvar_y = float(np.mean((y - ybar) ** 2))\ngrid = np.linspace(y.min() - 5, y.max() + 5, 20001)\nsq_const = np.array([np.mean((y - c) ** 2) for c in grid])\nabs_const = np.array([np.mean(np.abs(y - c)) for c in grid])\ncheck(f\"[B-constant] average squared error of a constant c equals the \"\n      f\"sample variance {var_y:.2f} plus (c - mean)^2 for every c\",\n      np.allclose(sq_const, var_y + (grid - ybar) ** 2))\ncheck(f\"[B-constant] the sample mean {ybar:.2f} is the best constant under \"\n      f\"the squared error loss (average {var_y:.2f})\",\n      abs(grid[np.argmin(sq_const)] - ybar) < 2e-3)\ncheck(f\"[B-constant] the median {ymed:.2f} is the best constant under the \"\n      f\"absolute error loss (average {abs_const.min():.2f})\",\n      abs(grid[np.argmin(abs_const)] - ymed) < 2e-3)\ncheck(f\"[B-constant] the least-squares line lowers the average squared \"\n      f\"error from {var_y:.2f} (best constant) to {train_err:.2f}\",\n      train_err < var_y)"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-gauss]** Gaussian noise: the negative log-likelihood of a label is an increasing affine function of its squared error loss, so the least-squares line is the maximum likelihood estimate, and the training error is the maximum likelihood variance."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-gauss] Gaussian noise: negative log-likelihood vs squared error\")\n\n\ndef nll(w, sigma2, x, y):\n    \"\"\"Negative log-likelihood of the labels under y = h(x) + Gaussian\n    noise of variance sigma2.\"\"\"\n    return float(np.sum(sq_loss(w, x, y) / (2 * sigma2)\n                        + 0.5 * np.log(2 * np.pi * sigma2)))\n\n\nsigma2 = train_err\ncheck(\"[B-gauss] for every line, the negative log-likelihood equals \"\n      \"m/(2 sigma^2) times the average squared error loss plus \"\n      \"(m/2) ln(2 pi sigma^2)\",\n      all(abs(nll(w, sigma2, x, y)\n              - (m / (2 * sigma2) * sq_loss(w, x, y).mean()\n                 + m / 2 * np.log(2 * np.pi * sigma2))) < 1e-9\n          for w in others))\ncheck(\"[B-gauss] the least-squares line has the smallest negative \"\n      \"log-likelihood among the 501 lines, for every noise variance\",\n      all(nll(w_ls, s2, x, y) < min(nll(w, s2, x, y) for w in others)\n          for s2 in (1.0, sigma2, 100.0)))\ns2_grid = np.linspace(1.0, 60.0, 5901)\nnll_s2 = np.array([nll(w_ls, s2, x, y) for s2 in s2_grid])\ncheck(f\"[B-gauss] the maximum likelihood noise variance is the training \"\n      f\"error {train_err:.2f}\",\n      abs(s2_grid[np.argmin(nll_s2)] - train_err) < 1e-2)"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-outlier]** One training day's label is raised by Delta = 0, ..., 30 degrees; the least-squares line moves in proportion to Delta (the proportionality constant is the day's leverage), while the least-absolute-deviation line and the Huber line stop moving once the corrupted day is far from them."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-outlier] one day's label raised by Delta: least squares, least \"\n      \"absolute deviation, Huber\")\n\n\ndef lad(X, x, y):\n    \"\"\"Least absolute deviation line: an optimal line passes through two\n    training days with distinct mornings (a vertex of the linear program),\n    so the exact minimizer is found by enumerating the pairs.\"\"\"\n    best, best_val = None, np.inf\n    for i in range(len(x)):\n        for j in range(i + 1, len(x)):\n            if x[i] == x[j]:\n                continue\n            w1 = (y[j] - y[i]) / (x[j] - x[i])\n            w = np.array([y[i] - w1 * x[i], w1])\n            val = abs_loss(w, x, y).mean()\n            if val < best_val - 1e-12:\n                best, best_val = w, val\n    return best, best_val\n\n\ndef huber_loss(r, delta):\n    a = np.abs(r)\n    return np.where(a <= delta, r ** 2, 2 * delta * a - delta ** 2)\n\n\ndef huber(X, x, y, delta, iters=500):\n    \"\"\"Huber line by iteratively reweighted least squares: the fixed\n    point of w <- argmin sum_i c_i (y_i - h(x_i))^2 with c_i = 1 for a\n    residual within delta and delta/|r_i| beyond.\"\"\"\n    w = least_squares(X, y)\n    for _ in range(iters):\n        r = y - X @ w\n        c = np.where(np.abs(r) <= delta, 1.0, delta / np.maximum(np.abs(r),\n                                                                 1e-12))\n        w_new = np.linalg.solve(X.T @ (c[:, None] * X), X.T @ (c * y))\n        if np.max(np.abs(w_new - w)) < 1e-12:\n            w = w_new\n            break\n        w = w_new\n    return w\n\n\nDELTA_HUBER = 3.0\nr_day = int(np.argmax(x))          # the training day with the warmest morning\nH = X @ np.linalg.solve(X.T @ X, X.T)\nleverage = float(H[r_day, r_day])\nw_lad0, _ = lad(X, x, y)\nw_hub0 = huber(X, x, y, DELTA_HUBER)\ncheck(f\"[B-outlier] corrupted day {dates[r_day]}: morning minimum \"\n      f\"{x[r_day]:.1f}, maximum {y[r_day]:.1f}; its leverage is \"\n      f\"{leverage:.3f}\", 0 < leverage < 1)\ncheck(f\"[B-outlier] clean lines: least squares {w_ls[0]:.2f} + \"\n      f\"{w_ls[1]:.2f} x, least absolute deviation {w_lad0[0]:.2f} + \"\n      f\"{w_lad0[1]:.2f} x, Huber (delta = {DELTA_HUBER:.0f}) \"\n      f\"{w_hub0[0]:.2f} + {w_hub0[1]:.2f} x\",\n      abs(w_lad0[1] - w_ls[1]) < 0.5)\nr_hub = y - X @ w_hub0\ngrad_hub = X.T @ np.where(np.abs(r_hub) <= DELTA_HUBER, 2 * r_hub,\n                          2 * DELTA_HUBER * np.sign(r_hub))\ncheck(\"[B-outlier] the Huber line is a stationary point of the average \"\n      \"Huber loss (its gradient vanishes)\", np.allclose(grad_hub, 0, atol=1e-6))\ndeltas = np.arange(0.0, 30.5, 1.0)\ndisp = {\"ls\": [], \"lad\": [], \"huber\": []}\nfor d in deltas:\n    y_pert = y.copy()\n    y_pert[r_day] += d\n    w1 = least_squares(X, y_pert)\n    w2, _ = lad(X, x, y_pert)\n    w3 = huber(X, x, y_pert, DELTA_HUBER)\n    for key, w, w0 in ((\"ls\", w1, w_ls), (\"lad\", w2, w_lad0),\n                       (\"huber\", w3, w_hub0)):\n        disp[key].append(float(line(w, x[r_day]) - line(w0, x[r_day])))\ndisp = {k: np.array(v) for k, v in disp.items()}\ncheck(f\"[B-outlier] least squares: the line at that morning moves by \"\n      f\"exactly leverage times Delta, {leverage:.3f} degrees per degree; \"\n      f\"{disp['ls'][-1]:.2f} degrees at Delta = {deltas[-1]:.0f}\",\n      np.allclose(disp[\"ls\"], leverage * deltas, atol=1e-9))\nw_ls30 = least_squares(X, np.where(np.arange(m) == r_day, y + 30.0, y))\ncheck(f\"[B-outlier] at Delta = 30 the least-squares slope rises from \"\n      f\"{w_ls[1]:.2f} to {w_ls30[1]:.2f} degrees per degree\",\n      w_ls30[1] > w_ls[1])\nlad_stop = deltas[np.argmax(np.isclose(disp[\"lad\"], disp[\"lad\"][-1]))]\nhub_stop = deltas[np.argmax(np.isclose(disp[\"huber\"], disp[\"huber\"][-1],\n                                       atol=1e-6))]\ncheck(f\"[B-outlier] least absolute deviation: the line moves by at most \"\n      f\"{np.abs(disp['lad']).max():.2f} degrees and does not change beyond \"\n      f\"Delta = {lad_stop:.0f}\",\n      np.abs(disp[\"lad\"]).max() < disp[\"ls\"][-1] / 2)\ncheck(f\"[B-outlier] Huber: the line moves by {disp['huber'][-1]:.2f} degrees \"\n      f\"and does not change beyond Delta = {hub_stop:.0f}\",\n      np.allclose(disp[\"huber\"][deltas >= hub_stop], disp[\"huber\"][-1],\n                  atol=1e-6) and disp[\"huber\"][-1] < disp[\"ls\"][-1])\ncheck(\"[B-outlier] the displacement of the least-squares line is the \"\n      \"largest of the three at Delta = 30\",\n      disp[\"ls\"][-1] > max(abs(disp[\"lad\"][-1]), abs(disp[\"huber\"][-1])))"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "**[B-plot]** CSVs for the figure and the matplotlib preview."
  },
  {
   "cell_type": "code",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "print(\"[B-plot] training days, least-squares line, displacement curves\")\nwith open(OUT_DIR / \"sqerrloss_points.csv\", \"w\") as fh:\n    fh.write(\"date,tmin,tmax,pred,loss,corrupted\\n\")\n    for i in range(m):\n        fh.write(f\"{dates[i]},{x[i]:.1f},{y[i]:.1f},{line(w_ls, x[i]):.4f},\"\n                 f\"{losses[i]:.4f},{int(i == r_day)}\\n\")\nxs = np.linspace(x.min() - 1, x.max() + 1, 2)\nwith open(OUT_DIR / \"sqerrloss_lines.csv\", \"w\") as fh:\n    fh.write(\"tmin,ls\\n\")\n    for v in xs:\n        fh.write(f\"{v:.3f},{line(w_ls, v):.4f}\\n\")\nwith open(OUT_DIR / \"sqerrloss_outlier.csv\", \"w\") as fh:\n    fh.write(\"delta,ls,lad,huber\\n\")\n    for i, d in enumerate(deltas):\n        fh.write(f\"{d:.0f},{disp['ls'][i]:.4f},{disp['lad'][i]:.4f},\"\n                 f\"{disp['huber'][i]:.4f}\\n\")\ncheck(f\"[B-plot] all {m} training days are drawn; the displacement curve \"\n      f\"has {len(deltas)} points\", len(deltas) == 31)\n\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9.4, 3.9))\nfor i in range(m):\n    ax1.plot([x[i], x[i]], [y[i], line(w_ls, x[i])], color=\"0.6\", lw=0.7,\n             ls=\"--\")\nax1.scatter(x, y, marker=\"o\", facecolors=\"none\", edgecolors=\"black\", s=28,\n            label=f\"training days (every {STRIDE}th day of 2024)\")\nax1.plot(xs, line(w_ls, xs), \"k-\", label=\"least-squares line\")\nax1.scatter([x[r_day]], [y[r_day]], marker=\"s\", facecolors=\"none\",\n            edgecolors=\"black\", s=60, label=\"day corrupted in (b)\")\nax1.set_xlabel(\"morning minimum temperature (\u00b0C)\")\nax1.set_ylabel(\"maximum daytime temperature (\u00b0C)\")\nax1.set_title(\"loss of a day: squared dashed length\")\nax1.legend(frameon=False, fontsize=8)\nax2.plot(deltas, disp[\"ls\"], \"k-\", label=\"squared error loss\")\nax2.plot(deltas, disp[\"lad\"], \"k--\", label=\"absolute error loss\")\nax2.plot(deltas, disp[\"huber\"], \"k:\", label=f\"Huber loss (delta = \"\n         f\"{DELTA_HUBER:.0f})\")\nax2.set_xlabel(\"error added to one day's label, Delta (\u00b0C)\")\nax2.set_ylabel(\"line displacement at that day (\u00b0C)\")\nax2.set_title(\"one corrupted label moves the learned lines\")\nax2.legend(frameon=False, fontsize=8)\nfig.tight_layout()\nfig.savefig(OUT_DIR / \"sqerrloss.png\", dpi=110)\n\nn_ok = sum(ok for _, ok in report)\nprint(f\"\\n{n_ok}/{len(report)} checks pass\")\nif n_ok != len(report):\n    raise SystemExit(1)"
  }
 ]
}