{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "---\n",
    "execute:\n",
    "  enabled: false\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-1 fw=all -->\n",
    "\n",
    "# Softmax Regression Implementation from Scratch\n",
    "\n",
    "Because softmax regression is so fundamental,\n",
    "we believe that you ought to know\n",
    "how to implement it yourself.\n",
    "Here, we limit ourselves to defining the\n",
    "softmax-specific aspects of the model\n",
    "and reuse the other components\n",
    "from our linear regression section,\n",
    "including the training loop."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-softmax-regression-implementation-from-scratch"
   },
   "source": [
    "from d2l import torch as d2l\n",
    "import torch"
   ],
   "execution_count": 1,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-2 fw=all -->\n",
    "\n",
    "## The Softmax\n",
    "\n",
    "Let's begin with the core piece:\n",
    "the mapping from scalars to probabilities.\n",
    "Softmax normalizes each *row* of a matrix, so we will need per-row sums;\n",
    "recall from that section and\n",
    "that section how `axis` selects the dimension\n",
    "a sum collapses and `keepdims` preserves it for broadcasting:"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-softmax-1"
   },
   "source": [
    "X = d2l.tensor([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])\n",
    "d2l.reduce_sum(X, 0, keepdims=True), d2l.reduce_sum(X, 1, keepdims=True)"
   ],
   "execution_count": 2,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "(tensor([[5., 7., 9.]]),\n tensor([[ 6.],\n         [15.]]))"
     },
     "metadata": {},
     "execution_count": 2
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-3 fw=all -->\n",
    "\n",
    "Computing the softmax requires three steps:\n",
    "(i) exponentiation of each term;\n",
    "(ii) a sum over each row to compute the normalization constant for each example;\n",
    "(iii) division of each row by its normalization constant,\n",
    "ensuring that the result sums to 1:\n",
    "\n",
    "\n",
    "$$\\mathrm{softmax}(\\mathbf{X})_{ij} = \\frac{\\exp(\\mathbf{X}_{ij})}{\\sum_k \\exp(\\mathbf{X}_{ik})}.$$\n",
    "\n",
    "\n",
    "The (logarithm of the) denominator\n",
    "is called the (log) *partition function*.\n",
    "It was introduced in [statistical physics](https://en.wikipedia.org/wiki/Partition_function_(statistical_mechanics))\n",
    "to sum over all possible states in a thermodynamic ensemble.\n",
    "The implementation is straightforward:"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-softmax-2"
   },
   "source": [
    "def softmax(X):\n",
    "    X_exp = d2l.exp(X)\n",
    "    partition = d2l.reduce_sum(X_exp, 1, keepdims=True)\n",
    "    return X_exp / partition  # The broadcasting mechanism is applied here"
   ],
   "execution_count": 3,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-4 fw=all -->\n",
    "\n",
    "For any input `X`, we turn each element\n",
    "into a nonnegative number.\n",
    "Each row sums up to 1,\n",
    "as is required for a probability. Caution: the code above is *not* robust against very large or very small arguments. While it is sufficient to illustrate what is happening, you should *not* use this code verbatim for any serious purpose. Deep learning frameworks have such protections built in and we will be using the built-in softmax going forward.\n",
    "\n",
    "To see the failure rather than just assert it, feed in a logit that is large\n",
    "on the scale of $\\exp$. A score of $1000$ overflows `exp` to infinity in\n",
    "float32, so the naive ratio becomes $\\infty/\\infty$, which evaluates to `NaN`.\n",
    "The framework's `softmax` subtracts the per-row maximum before exponentiating\n",
    "(the log-sum-exp trick of that section) and\n",
    "returns a finite distribution on exactly the same input:"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-softmax-overflow"
   },
   "source": [
    "z = torch.tensor([1000., 0., 0.])\n",
    "naive = torch.exp(z) / torch.exp(z).sum()  # exp(1000) overflows -> nan\n",
    "stable = torch.softmax(z, dim=0)           # built-in uses the log-sum-exp trick\n",
    "naive, stable"
   ],
   "execution_count": 4,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "(tensor([nan, 0., 0.]), tensor([1., 0., 0.]))"
     },
     "metadata": {},
     "execution_count": 4
    }
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-softmax-3"
   },
   "source": [
    "X = d2l.rand((2, 5))\n",
    "X_prob = softmax(X)\n",
    "X_prob, d2l.reduce_sum(X_prob, 1)"
   ],
   "execution_count": 5,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "(tensor([[0.1487, 0.2466, 0.1683, 0.2644, 0.1720],\n         [0.1916, 0.1833, 0.2432, 0.2470, 0.1350]]),\n tensor([1., 1.]))"
     },
     "metadata": {},
     "execution_count": 5
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-5 fw=all -->\n",
    "\n",
    "## The Model\n",
    "\n",
    "We now have everything that we need\n",
    "to implement the softmax regression model.\n",
    "As in our linear regression example,\n",
    "each instance will be represented\n",
    "by a fixed-length vector.\n",
    "Since the raw data here consists\n",
    "of $28 \\times 28$ pixel images,\n",
    "we flatten each image,\n",
    "treating them as vectors of length 784.\n",
    "In later chapters, we will introduce\n",
    "convolutional neural networks,\n",
    "which exploit the spatial structure\n",
    "in a more satisfying way.\n",
    "\n",
    "\n",
    "In softmax regression,\n",
    "the number of outputs from our network\n",
    "should be equal to the number of classes.\n",
    "Since our dataset has 10 classes,\n",
    "our network has an output dimension of 10.\n",
    "Consequently, our weights constitute a $784 \\times 10$ matrix\n",
    "plus a $1 \\times 10$ row vector for the biases.\n",
    "As with linear regression,\n",
    "we initialize the weights `W`\n",
    "with Gaussian noise.\n",
    "The biases are initialized as zeros."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-model-1"
   },
   "source": [
    "class SoftmaxRegressionScratch(d2l.Classifier):\n",
    "    def __init__(self, num_inputs, num_outputs, lr, sigma=0.01):\n",
    "        super().__init__()\n",
    "        self.save_hyperparameters()\n",
    "        self.W = torch.normal(0, sigma, size=(num_inputs, num_outputs),\n",
    "                              requires_grad=True)\n",
    "        self.b = torch.zeros(num_outputs, requires_grad=True)\n",
    "\n",
    "    def parameters(self):\n",
    "        return [self.W, self.b]"
   ],
   "execution_count": 6,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-6 fw=all -->\n",
    "\n",
    "The code below defines how the network\n",
    "maps each input to an output.\n",
    "Note that we flatten each $28 \\times 28$ pixel image in the batch\n",
    "into a vector using `reshape`\n",
    "before passing the data through our model."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-model-2"
   },
   "source": [
    "@d2l.add_to_class(SoftmaxRegressionScratch)\n",
    "def forward(self, X):\n",
    "    X = d2l.reshape(X, (-1, self.W.shape[0]))\n",
    "    return softmax(d2l.matmul(X, self.W) + self.b)"
   ],
   "execution_count": 7,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-7 fw=all -->\n",
    "\n",
    "## The Cross-Entropy Loss\n",
    "\n",
    "Next we need to implement the cross-entropy loss function\n",
    "(introduced in that section).\n",
    "This may be the most common loss function\n",
    "in deep-learning classification.\n",
    "Recall from that section that minimizing cross-entropy is equivalent to maximizing the log-likelihood of the correct labels under our categorical model. It is the natural loss for classification.\n",
    "At the moment, applications of deep learning\n",
    "easily cast as classification problems\n",
    "far outnumber those better treated as regression problems.\n",
    "\n",
    "Recall that cross-entropy takes the negative log-likelihood\n",
    "of the predicted probability assigned to the true label.\n",
    "For efficiency we avoid Python for-loops and use indexing instead.\n",
    "In particular, we select the correct-class probability for each row of\n",
    "$\\hat{\\mathbf{y}}$ (equivalent to a dot product with the one-hot label).\n",
    "\n",
    "To see this in action we create sample data `y_hat`\n",
    "with 2 examples of predicted probabilities over 3 classes and their corresponding labels `y`.\n",
    "The correct labels are $0$ and $2$ respectively (i.e., the first and third class).\n",
    "Using `y` as the indices of the probabilities in `y_hat`,\n",
    "we can pick out terms efficiently."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-cross-entropy-loss-1"
   },
   "source": [
    "y = d2l.tensor([0, 2])\n",
    "y_hat = d2l.tensor([[0.1, 0.3, 0.6], [0.3, 0.2, 0.5]])\n",
    "y_hat[[0, 1], y]"
   ],
   "execution_count": 8,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "tensor([0.1000, 0.5000])"
     },
     "metadata": {},
     "execution_count": 8
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-8 fw=pytorch, mxnet, tensorflow -->\n",
    "\n",
    "Now we can implement the cross-entropy loss function by averaging over the logarithms of the selected probabilities."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-cross-entropy-loss-2"
   },
   "source": [
    "def cross_entropy(y_hat, y):\n",
    "    # Tiny clip to keep log finite when softmax outputs underflow to 0.\n",
    "    p = y_hat[list(range(len(y_hat))), y].clamp(min=1e-12)\n",
    "    return -d2l.reduce_mean(d2l.log(p))\n",
    "\n",
    "cross_entropy(y_hat, y)"
   ],
   "execution_count": 9,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "tensor(1.4979)"
     },
     "metadata": {},
     "execution_count": 9
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-9 fw=all -->\n",
    "\n",
    "Note that we clip $\\hat{y}$ away from zero before taking $\\log$. Without the clip, $\\log(\\hat{y})$ produces $-\\infty$ (and downstream NaNs) whenever the softmax assigns probability exactly zero to the correct class. Production code typically uses a log-softmax layer that fuses the softmax and log into a single numerically stable operation; the explicit clamp here is the minimal change that keeps the scratch implementation usable as a teaching example without changing its mathematical form. The proper fix, fusing softmax and cross-entropy via the log-sum-exp trick, is derived in that section."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-the-cross-entropy-loss-3"
   },
   "source": [
    "@d2l.add_to_class(SoftmaxRegressionScratch)\n",
    "def loss(self, y_hat, y):\n",
    "    return cross_entropy(y_hat, y)"
   ],
   "execution_count": 10,
   "outputs": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-10 fw=all -->\n",
    "\n",
    "## Training\n",
    "\n",
    "We reuse the `fit` method defined in that section to train the model with 10 epochs.\n",
    "Note that the number of epochs (`max_epochs`),\n",
    "the minibatch size (`batch_size`),\n",
    "and learning rate (`lr`)\n",
    "are adjustable hyperparameters.\n",
    "That means that while these values are not\n",
    "learned during our primary training loop,\n",
    "they still influence the performance\n",
    "of our model, affecting both training\n",
    "and generalization.\n",
    "In practice you will want to choose these values\n",
    "based on the *validation* split of the data\n",
    "and then, ultimately, to evaluate your final model\n",
    "on the *test* split.\n",
    "As discussed in that section,\n",
    "we will regard the test data of Fashion-MNIST\n",
    "as the validation set, thus\n",
    "reporting validation loss and validation accuracy\n",
    "on this split."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-training"
   },
   "source": [
    "data = d2l.FashionMNIST(batch_size=256)\n",
    "model = SoftmaxRegressionScratch(num_inputs=784, num_outputs=10, lr=0.1)\n",
    "trainer = d2l.Trainer(max_epochs=10)\n",
    "trainer.fit(model, data)"
   ],
   "execution_count": 11,
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"238.965625pt\" height=\"183.35625pt\" viewBox=\"0 0 238.965625 183.35625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2026-07-19T13:49:32.108056</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.8, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 183.35625 \nL 238.965625 183.35625 \nL 238.965625 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 30.103125 145.8 \nL 225.403125 145.8 \nL 225.403125 7.2 \nL 30.103125 7.2 \nz\n\" 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=\"m5b2931cadc\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"30.103125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0 -->\n      <g transform=\"translate(26.921875 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"69.163125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 2 -->\n      <g transform=\"translate(65.981875 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"108.223125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 4 -->\n      <g transform=\"translate(105.041875 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"147.283125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 6 -->\n      <g transform=\"translate(144.101875 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"186.343125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 8 -->\n      <g transform=\"translate(183.161875 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \nQ 1584 2216 1326 1975 \nQ 1069 1734 1069 1313 \nQ 1069 891 1326 650 \nQ 1584 409 2034 409 \nQ 2484 409 2743 651 \nQ 3003 894 3003 1313 \nQ 3003 1734 2745 1975 \nQ 2488 2216 2034 2216 \nz\nM 1403 2484 \nQ 997 2584 770 2862 \nQ 544 3141 544 3541 \nQ 544 4100 942 4425 \nQ 1341 4750 2034 4750 \nQ 2731 4750 3128 4425 \nQ 3525 4100 3525 3541 \nQ 3525 3141 3298 2862 \nQ 3072 2584 2669 2484 \nQ 3125 2378 3379 2068 \nQ 3634 1759 3634 1313 \nQ 3634 634 3220 271 \nQ 2806 -91 2034 -91 \nQ 1263 -91 848 271 \nQ 434 634 434 1313 \nQ 434 1759 690 2068 \nQ 947 2378 1403 2484 \nz\nM 1172 3481 \nQ 1172 3119 1398 2916 \nQ 1625 2713 2034 2713 \nQ 2441 2713 2670 2916 \nQ 2900 3119 2900 3481 \nQ 2900 3844 2670 4047 \nQ 2441 4250 2034 4250 \nQ 1625 4250 1398 4047 \nQ 1172 3844 1172 3481 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m5b2931cadc\" x=\"225.403125\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 10 -->\n      <g transform=\"translate(219.040625 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.623047 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_7\">\n     <!-- epoch -->\n     <g transform=\"translate(112.525 174.076563) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \nL 3122 2828 \nQ 2878 2963 2633 3030 \nQ 2388 3097 2138 3097 \nQ 1578 3097 1268 2742 \nQ 959 2388 959 1747 \nQ 959 1106 1268 751 \nQ 1578 397 2138 397 \nQ 2388 397 2633 464 \nQ 2878 531 3122 666 \nL 3122 134 \nQ 2881 22 2623 -34 \nQ 2366 -91 2075 -91 \nQ 1284 -91 818 406 \nQ 353 903 353 1747 \nQ 353 2603 823 3093 \nQ 1294 3584 2113 3584 \nQ 2378 3584 2631 3529 \nQ 2884 3475 3122 3366 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-65\"/>\n      <use xlink:href=\"#DejaVuSans-70\" transform=\"translate(61.523438 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(125 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(186.181641 0)\"/>\n      <use xlink:href=\"#DejaVuSans-68\" transform=\"translate(241.162109 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_7\">\n      <defs>\n       <path id=\"me7002f1d60\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#me7002f1d60\" x=\"30.103125\" y=\"125.709695\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0.5 -->\n      <g transform=\"translate(7.2 129.508913) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#me7002f1d60\" x=\"30.103125\" y=\"99.630787\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 0.6 -->\n      <g transform=\"translate(7.2 103.430006) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-36\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_9\">\n      <g>\n       <use xlink:href=\"#me7002f1d60\" x=\"30.103125\" y=\"73.551879\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_10\">\n      <!-- 0.7 -->\n      <g transform=\"translate(7.2 77.351098) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-37\" d=\"M 525 4666 \nL 3525 4666 \nL 3525 4397 \nL 1831 0 \nL 1172 0 \nL 2766 4134 \nL 525 4134 \nL 525 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#me7002f1d60\" x=\"30.103125\" y=\"47.472971\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.8 -->\n      <g transform=\"translate(7.2 51.27219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_11\">\n      <g>\n       <use xlink:href=\"#me7002f1d60\" x=\"30.103125\" y=\"21.394064\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.9 -->\n      <g transform=\"translate(7.2 25.193282) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-39\" d=\"M 703 97 \nL 703 672 \nQ 941 559 1184 500 \nQ 1428 441 1663 441 \nQ 2288 441 2617 861 \nQ 2947 1281 2994 2138 \nQ 2813 1869 2534 1725 \nQ 2256 1581 1919 1581 \nQ 1219 1581 811 2004 \nQ 403 2428 403 3163 \nQ 403 3881 828 4315 \nQ 1253 4750 1959 4750 \nQ 2769 4750 3195 4129 \nQ 3622 3509 3622 2328 \nQ 3622 1225 3098 567 \nQ 2575 -91 1691 -91 \nQ 1453 -91 1209 -44 \nQ 966 3 703 97 \nz\nM 1959 2075 \nQ 2384 2075 2632 2365 \nQ 2881 2656 2881 3163 \nQ 2881 3666 2632 3958 \nQ 2384 4250 1959 4250 \nQ 1534 4250 1286 3958 \nQ 1038 3666 1038 3163 \nQ 1038 2656 1286 2365 \nQ 1534 2075 1959 2075 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-39\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_12\">\n    <path d=\"M 34.923295 13.5 \nL 44.646742 88.11705 \nL 54.370189 104.01063 \nL 64.093636 110.634681 \nL 73.817082 117.04768 \nL 83.540529 121.120585 \nL 93.263976 124.538145 \nL 102.987423 125.851449 \nL 112.71087 128.15084 \nL 122.434316 130.560944 \nL 132.157763 132.184598 \nL 141.88121 132.515253 \nL 151.604657 135.598026 \nL 161.328104 134.07255 \nL 171.051551 136.019219 \nL 180.774997 136.812831 \nL 190.498444 137.261682 \nL 200.221891 138.67215 \nL 209.945338 138.860153 \nL 219.668785 139.5 \n\" clip-path=\"url(#p7e8404fef9)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_13\">\n    <path d=\"M 49.633125 94.333616 \nL 69.163125 110.636896 \nL 88.693125 117.977031 \nL 108.223125 122.277294 \nL 127.753125 117.56781 \nL 147.283125 122.560172 \nL 166.813125 126.197877 \nL 186.343125 128.574057 \nL 205.873125 131.176068 \nL 225.403125 125.480522 \n\" clip-path=\"url(#p7e8404fef9)\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #ff7f0e; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"line2d_14\">\n    <path d=\"M 49.633125 48.975565 \nL 69.163125 43.652819 \nL 88.693125 41.742743 \nL 108.223125 40.596697 \nL 127.753125 44.900735 \nL 147.283125 41.921016 \nL 166.813125 39.832666 \nL 186.343125 39.730796 \nL 205.873125 38.610218 \nL 225.403125 41.564469 \n\" clip-path=\"url(#p7e8404fef9)\" style=\"fill: none; stroke-dasharray: 9.6,2.4,1.5,2.4; stroke-dashoffset: 0; stroke: #2ca02c; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 30.103125 145.8 \nL 30.103125 7.2 \n\" 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 225.403125 145.8 \nL 225.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 30.103125 145.8 \nL 225.403125 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 30.103125 7.2 \nL 225.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"legend_1\">\n    <g id=\"patch_7\">\n     <path d=\"M 138.8125 100.434375 \nL 218.403125 100.434375 \nQ 220.403125 100.434375 220.403125 98.434375 \nL 220.403125 54.565625 \nQ 220.403125 52.565625 218.403125 52.565625 \nL 138.8125 52.565625 \nQ 136.8125 52.565625 136.8125 54.565625 \nL 136.8125 98.434375 \nQ 136.8125 100.434375 138.8125 100.434375 \nz\n\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n    </g>\n    <g id=\"line2d_15\">\n     <path d=\"M 140.8125 60.664063 \nL 150.8125 60.664063 \nL 160.8125 60.664063 \n\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_13\">\n     <!-- train_loss -->\n     <g transform=\"translate(168.8125 64.164063) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \nQ 2534 3019 2420 3045 \nQ 2306 3072 2169 3072 \nQ 1681 3072 1420 2755 \nQ 1159 2438 1159 1844 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1341 3275 1631 3429 \nQ 1922 3584 2338 3584 \nQ 2397 3584 2469 3576 \nQ 2541 3569 2628 3553 \nL 2631 2963 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-5f\" d=\"M 3263 -1063 \nL 3263 -1509 \nL -63 -1509 \nL -63 -1063 \nL 3263 -1063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-74\"/>\n      <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(39.208984 0)\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(80.322266 0)\"/>\n      <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(141.601562 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(169.384766 0)\"/>\n      <use xlink:href=\"#DejaVuSans-5f\" transform=\"translate(232.763672 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(282.763672 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(310.546875 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(371.728516 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(423.828125 0)\"/>\n     </g>\n    </g>\n    <g id=\"line2d_16\">\n     <path d=\"M 140.8125 75.620313 \nL 150.8125 75.620313 \nL 160.8125 75.620313 \n\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #ff7f0e; stroke-width: 1.5\"/>\n    </g>\n    <g id=\"text_14\">\n     <!-- val_loss -->\n     <g transform=\"translate(168.8125 79.120313) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-76\" d=\"M 191 3500 \nL 800 3500 \nL 1894 563 \nL 2988 3500 \nL 3597 3500 \nL 2284 0 \nL 1503 0 \nL 191 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-76\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(59.179688 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(120.458984 0)\"/>\n      <use xlink:href=\"#DejaVuSans-5f\" transform=\"translate(148.242188 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(198.242188 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(226.025391 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(287.207031 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(339.306641 0)\"/>\n     </g>\n    </g>\n    <g id=\"line2d_17\">\n     <path d=\"M 140.8125 90.576563 \nL 150.8125 90.576563 \nL 160.8125 90.576563 \n\" style=\"fill: none; stroke-dasharray: 9.6,2.4,1.5,2.4; stroke-dashoffset: 0; stroke: #2ca02c; stroke-width: 1.5\"/>\n    </g>\n    <g id=\"text_15\">\n     <!-- val_acc -->\n     <g transform=\"translate(168.8125 94.076563) scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-76\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(59.179688 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(120.458984 0)\"/>\n      <use xlink:href=\"#DejaVuSans-5f\" transform=\"translate(148.242188 0)\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(198.242188 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(259.521484 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(314.501953 0)\"/>\n     </g>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p7e8404fef9\">\n   <rect x=\"30.103125\" y=\"7.2\" width=\"195.3\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {}
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-11 fw=all -->\n",
    "\n",
    "## Prediction\n",
    "\n",
    "Now that training is complete,\n",
    "our model is ready to classify some images."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-prediction-1"
   },
   "source": [
    "X, y = next(iter(data.val_dataloader()))\n",
    "with torch.no_grad():\n",
    "    preds = d2l.argmax(model(X), axis=1)\n",
    "preds.shape"
   ],
   "execution_count": 12,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "torch.Size([256])"
     },
     "metadata": {},
     "execution_count": 12
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-12 fw=all -->\n",
    "\n",
    "How well do we do overall? We sweep the whole validation set and average the\n",
    "per-example correct/incorrect flags returned by `accuracy`:"
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-prediction-accuracy"
   },
   "source": [
    "correct = []\n",
    "for X_i, y_i in data.val_dataloader():\n",
    "    with torch.no_grad():\n",
    "        correct.append(model.accuracy(model(X_i), y_i, averaged=False))\n",
    "print(f'Test accuracy: {torch.cat(correct).mean():.3f}')"
   ],
   "execution_count": 13,
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Test accuracy: 0.823\n"
     ]
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-13 fw=all -->\n",
    "\n",
    "The overall test accuracy comes out at roughly 82--83% (the exact value\n",
    "varies a little from run to run), consistent with the training\n",
    "curve: the ceiling of a linear model on Fashion-MNIST. We are more interested in\n",
    "the images we label *incorrectly*. We visualize them by\n",
    "comparing their actual labels\n",
    "(first line of text output)\n",
    "with the predictions from the model\n",
    "(second line of text output)."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-prediction-2"
   },
   "source": [
    "wrong = d2l.astype(preds, y.dtype) != y\n",
    "X, y, preds = X[wrong], y[wrong], preds[wrong]\n",
    "labels = [a+'\\n'+b for a, b in zip(\n",
    "    data.text_labels(y), data.text_labels(preds))]\n",
    "data.visualize([X, y], labels=labels)"
   ],
   "execution_count": 14,
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"684pt\" height=\"114.189543pt\" viewBox=\"0 0 684 114.189543\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2026-07-19T13:49:33.164771</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.8, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 114.189543 \nL 684 114.189543 \nL 684 -0 \nL 0 -0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 7.2 106.989543 \nL 78.434043 106.989543 \nL 78.434043 35.7555 \nL 7.2 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p7423ef18c5)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAJkUlEQVR4nO1dW2wcVxme295n7fX6km0c28GJa7cJUaSmqtIQIaTCSwQtUiVaqFQkVFV9QuQFqAR9r1BV8YJaoSKBqBDKEwVRghBC3KQSCI1wm9qN27W99voSe+87szM7w9v5z3dab9ejbThU53v6j7/dufjf/3L+888Z/SH90VCLAGv2OIxvP1hgsjNiAFf40RtMDn0fD6TrJIeRLmVg0C0Lxvy1mvMngXv7O8M0cE3gZl6j+0j85h99n9/46I8o3CkoZUgEpQyJYH30Rz4cS0/fBWN7YZ/JR4dqwDnvnGVy7Oo14PR4nMmh60a9nMHARN+vcTHDmckBdeRIhclb6yPAOSN0nMQhTq8sQyIoZUiEyG4qFNTYaCaZvBYgOeH3SFm73aiXcD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u74GXI+dentCWYZEUMqQCEoZEmFgMSPxNqWeYYiL9wZX4ewmsXShczvSdG1hFY7bzLHUzAF33+jqh8qapmkjMey1feXPn6VrSwsePcOVQ4S0my/VGE2h+Y6LL92dXW0QUJYhEZQyJMLgGhLKtGjkdY4CF3Bpod7EU4Y+uQY9h2mvuUlu6uUvvArciRj1xS78+BngfvXkD2D8+gmqGpfW88Bp3IZfui+4KW5sHMHe4tgypcQ9XztxCCjLkAhKGRJBKUMiRH+DpSX6fvKbyUVc6dPvp2pou4WlkqBNx9GF92Bc+jy9v6IjbDD+B25173tf+SVw31//Iox/ce9PmXxx85vAGVwjRZAVNgvmVvMmxyrAZZ6l54s/EDH41w4F/b/VWVmGRFDKkAj6Q/qjH/urIfVzp5lc/Damj587vszk3928B7gLJ28xOR/HWfXFLD1te38S+6QuFx+BcdqilHlpH6sDezVKURMJdDjtFVrsmv8hLm75RazUDgLKMiSCUoZEUMqQCHckZvRC68sPMNl7SniVTof6aR+b/RdwT+T+yWRH2ClnzcfGhueWH2ZytY2rgvxub3OXsQ/Y38TNLT9uKMuQCEoZEuF/7qZ6Yekn9zH5wvwt4G5coUqsjy2ymi5MiU9deofJxZfuBi73s7/3dzHCy3wPM7PuF8oyJIJShkRQypAI/wVHa9P0bP9eOgAAAABJRU5ErkJggg==\" id=\"imageab488942db\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"7.2\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 7.2 106.989543 \nL 7.2 35.7555 \n\" 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 78.434043 106.989543 \nL 78.434043 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 7.2 106.989543 \nL 78.434043 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 7.2 35.7555 \nL 78.434043 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_1\">\n    <!-- coat -->\n    <g transform=\"translate(29.817646 16.318125) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \nL 3122 2828 \nQ 2878 2963 2633 3030 \nQ 2388 3097 2138 3097 \nQ 1578 3097 1268 2742 \nQ 959 2388 959 1747 \nQ 959 1106 1268 751 \nQ 1578 397 2138 397 \nQ 2388 397 2633 464 \nQ 2878 531 3122 666 \nL 3122 134 \nQ 2881 22 2623 -34 \nQ 2366 -91 2075 -91 \nQ 1284 -91 818 406 \nQ 353 903 353 1747 \nQ 353 2603 823 3093 \nQ 1294 3584 2113 3584 \nQ 2378 3584 2631 3529 \nQ 2884 3475 3122 3366 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-63\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(54.980469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(116.162109 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(177.441406 0)\"/>\n    </g>\n    <!-- pullover -->\n    <g transform=\"translate(18.490771 29.7555) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-75\" d=\"M 544 1381 \nL 544 3500 \nL 1119 3500 \nL 1119 1403 \nQ 1119 906 1312 657 \nQ 1506 409 1894 409 \nQ 2359 409 2629 706 \nQ 2900 1003 2900 1516 \nL 2900 3500 \nL 3475 3500 \nL 3475 0 \nL 2900 0 \nL 2900 538 \nQ 2691 219 2414 64 \nQ 2138 -91 1772 -91 \nQ 1169 -91 856 284 \nQ 544 659 544 1381 \nz\nM 1991 3584 \nL 1991 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-76\" d=\"M 191 3500 \nL 800 3500 \nL 1894 563 \nL 2988 3500 \nL 3597 3500 \nL 2284 0 \nL 1503 0 \nL 191 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \nQ 2534 3019 2420 3045 \nQ 2306 3072 2169 3072 \nQ 1681 3072 1420 2755 \nQ 1159 2438 1159 1844 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1341 3275 1631 3429 \nQ 1922 3584 2338 3584 \nQ 2397 3584 2469 3576 \nQ 2541 3569 2628 3553 \nL 2631 2963 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-70\"/>\n     <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(63.476562 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(126.855469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(154.638672 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(182.421875 0)\"/>\n     <use xlink:href=\"#DejaVuSans-76\" transform=\"translate(243.603516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(302.783203 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(364.306641 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_2\">\n   <g id=\"patch_7\">\n    <path d=\"M 92.680851 106.989543 \nL 163.914894 106.989543 \nL 163.914894 35.7555 \nL 92.680851 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p81be0dca2b)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAFUUlEQVR4nO2cTW8bVRSGZzzjr9jGdtKGNCGhokQiTVlUgCLYgliCQIh/wF9gV6Fu+AFsoIsukLpCQqKiCBCLLlAF5UOiVLSkITSF0oakTXDs2I49H+zuue8NE0ol0rN4n9U5Pndmbv3mnnvmzNT+C/5rqUdUkHvQEyACxVAExVAExVAExVAExVAExVAExVAExVAExVAExVAExVAExVAExVAExV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H7e2IOQHUj63n3gcYt+90TB2cXIbj7skaXHuRZzn4mezxnbbIY35u+C3bzSNXV3GVs30J5Km4is/ellEmRHP80PnyWZgt3sxLaZR9pm4MhRBMRRBMRThuz8yvPXpEWPnT43B4PJH3/yvkwnOT4K/+MOMsXPO0zu7VeG+oF1ax7FTZ36W4+5uZF7fzf2pk+/vmfT+freZK0MRFEMRoftB43XpzCbtZTdsyNXwhYS018sYiexV2m2cngE/XbCewjljK5PylsH0O3jLHy/+gv4e89lVlsIE9vdn4rkyFEExFEExFLErYSbtPd74uo9x/4X6Gfz/bu2Z54zdP4p70uQrV4z9rwWob5W6zj6w1x6233BlKIJiKGLXHTh5cHBlKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKIJiKOJv/fRtiyaMmuMAAAAASUVORK5CYII=\" id=\"image4da958d0af\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"92.680851\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_8\">\n    <path d=\"M 92.680851 106.989543 \nL 92.680851 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_9\">\n    <path d=\"M 163.914894 106.989543 \nL 163.914894 35.7555 \n\" 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 92.680851 106.989543 \nL 163.914894 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_11\">\n    <path d=\"M 92.680851 35.7555 \nL 163.914894 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_2\">\n    <!-- sneaker -->\n    <g transform=\"translate(104.585685 16.318125) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-6b\" d=\"M 581 4863 \nL 1159 4863 \nL 1159 1991 \nL 2875 3500 \nL 3609 3500 \nL 1753 1863 \nL 3688 0 \nL 2938 0 \nL 1159 1709 \nL 1159 0 \nL 581 0 \nL 581 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(115.478516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(177.001953 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(238.28125 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(292.566406 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(354.089844 0)\"/>\n    </g>\n    <!-- sandal -->\n    <g transform=\"translate(108.54006 29.7555) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \nL 2906 4863 \nL 3481 4863 \nL 3481 0 \nL 2906 0 \nL 2906 525 \nQ 2725 213 2448 61 \nQ 2172 -91 1784 -91 \nQ 1150 -91 751 415 \nQ 353 922 353 1747 \nQ 353 2572 751 3078 \nQ 1150 3584 1784 3584 \nQ 2172 3584 2448 3432 \nQ 2725 3281 2906 2969 \nz\nM 947 1747 \nQ 947 1113 1208 752 \nQ 1469 391 1925 391 \nQ 2381 391 2643 752 \nQ 2906 1113 2906 1747 \nQ 2906 2381 2643 2742 \nQ 2381 3103 1925 3103 \nQ 1469 3103 1208 2742 \nQ 947 2381 947 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(113.378906 0)\"/>\n     <use xlink:href=\"#DejaVuSans-64\" transform=\"translate(176.757812 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(240.234375 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(301.513672 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_3\">\n   <g id=\"patch_12\">\n    <path d=\"M 178.161702 106.989543 \nL 249.395745 106.989543 \nL 249.395745 35.7555 \nL 178.161702 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p873ebcf63c)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAALhUlEQVR4nO1daWxU1xV+s3jGMx57vHs8XrGNTQwG41ADYXOJCyEsZUlLgLYUKCpBtJC0TVSUqKVCSlGr0qQCXKmFQFKFBIgjQQ0hBBw2GzBgFgPGNjPeARvP4H32/rvnfVON5bFocyPd79d39fldv5kz99zzzj33PkWx4hWfJMAFlN/0DQgQhDE4gjAGR1AH88eNf5jKeNZMK2i9Ti3j+o0K0Dz1FsaVYWGg1e4Yx/j4POzzdouZrmsKBc1tdjD+ZdH7oH1/95vQ7hvlZvyVwiugHakoZNynwOlzTEk3496b96RAWHb3MbQbBuMZP7djCmjhBysD9iNGBkcQxuAIQbkprY3cT01dMnZko65GqzoC9vHkUzO0E5SdjN+0YJ9pSaQ90oaDFvEFta9OTQLN0OKFtldD9zZG1w7a60UnGN8YaQFNtZh+q3PN+VIghCkd0P5FzHnGTxmngoafAiFGBkcQxuAIwhgcIag5I6rWxXjmEitotyqzGPfU1gfsI1Tthrb9ZCLjSRYPaI2zSEvMwfDRHhvBeIszBrTOfAytY2/QHHL08QTQXjVdZvyKA0Pb3Y9mylrdoKmyRjFuUt8C7eIgzWH2MdhnrBQYYmRwBGEMjhCUmwq784jxZL0dtFpZ2Csp0E1IPhqqISp0RQMJpIW14XXms6S1anGAK5KoH4+E14Wk90J7sIkCSstnmaA9WGdlvM0VBdpm0ynGt0qFoA1mkGtMVz8FrcerYzzqjt93MQTEyOAIwhgcQRiDIwQ1Z3hiyPdOj/gatLLY5xlXqENA87mcjBdEN4PWkhbJuL3fAFpYsywsDHGBlpZJKReVhOGj7y720/2dQcYTj+K9HWmkUHduMmZmH3oipEDoyNcw7j9nHe6YxLi+A+fIoSBGBkcQxuAIQbmpwQQ94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f2tj0xMjiCMAZHGLGb6ksMbMcy+cqPJEmxejpxp+ZeCmg3+6nGaFLXStBMVVQrZUlJAy3N0cr4+szzoPmHz5kHNzCeU4JPy5KRihBuX0FfNP8m7cm483YiaB997++M70rGU4Sm7NwijQRiZHAEYQyOIIzBEUY8Z2jtGL7VdZN/7S/B17/Ne4fOTVc/h2FnTQUVkblsuELmrb7IeKYN5xpfNh08WaTH/bz+BWdSPG2Lbl6DJ7El7aQ9GXqtX6HcIipkUIdj+LyuajXjczLwDPWUg1bGhzpU2B9iZHAEYQyOoHhWL2e/v5deU6DU4Gk0EZX0JO0txhL5bhs9uUddRjcRX0mn8/iu43Zmy7u02POT+ZglrrJhGPz56C8YLx/A398fX6XtC72petDO/43CV4sL68R+VkdhuHYVnuzgeYRvThsuxMjgCMIYHEEYgyMEF9oqZWkGL84L2WspRFRnpIP2tIDmgpASv1fwLJeFun6z10Ayhbo6NaZY5KdlvB2LoeUmhxHaC+7PY3xJAm4hVtopVaOOxQMiJ+zYyHh8NR6Jof6a+hn+i3yGhhgZHEEYgyM8s9B2pJDvkv349gnQ1lup/uhaEz6Bbxx/lvG5Bgx7D9iwxsnuotD63NGJoBmmyF4kfwhPwIn6AGu1/tcQI4MjCGNwBGEMjvDM9mfI33SsUOFKm09+NrlfSOyx02reb9u/C1rdE8oEv1d4ELQeD80DNU58f8WWGFz5S1RTOP3ybKzndXjoK1A2YFpDDoUWT4nzuWT5WO+zCW7FyOAIwhgc4RsPbYeLrjUYrsado1qojhnopryY/IXzz1UO/LhxJf/f8HUoiJHBEYQxOIIwBkf4D/aXHSPrflWfAAAAAElFTkSuQmCC\" id=\"image7a119e7102\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"178.161702\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_13\">\n    <path d=\"M 178.161702 106.989543 \nL 178.161702 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_14\">\n    <path d=\"M 249.395745 106.989543 \nL 249.395745 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_15\">\n    <path d=\"M 178.161702 106.989543 \nL 249.395745 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_16\">\n    <path d=\"M 178.161702 35.7555 \nL 249.395745 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_3\">\n    <!-- coat -->\n    <g transform=\"translate(200.779348 16.318125) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-63\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(54.980469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(116.162109 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(177.441406 0)\"/>\n    </g>\n    <!-- pullover -->\n    <g transform=\"translate(189.452473 29.7555) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-70\"/>\n     <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(63.476562 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(126.855469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(154.638672 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(182.421875 0)\"/>\n     <use xlink:href=\"#DejaVuSans-76\" transform=\"translate(243.603516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(302.783203 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(364.306641 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_4\">\n   <g id=\"patch_17\">\n    <path d=\"M 263.642553 106.989543 \nL 334.876596 106.989543 \nL 334.876596 35.7555 \nL 263.642553 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#pb80d041591)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAF7UlEQVR4nO2bbUxbVRjH7217C22hlPL+4rrOMlCY4pybDoh8QCKLMfGFGN+zxM1PupAlJsZ9NCbqjDGa+NlkkpllSwQ3NWFf1Dk3J4pBEBk2MigwYC20paWvfjtP/ywsjmT6YJ7fp//hf7n3pP+ec8997qneoT+Z1QQWmP7rDgiEhMEICYMREgYjJAxGSBiMkDAYIWEwQsJghITBCAmDERIGIyQMRkgYjJAwGCFhMELCYISEwQgJgxESBiMkDEZIGIyQMBghYTBCwmCEhMEICYMRFk3X8S/ZjW29NTU1KD12sAhPaaVzmhxJ8Kz5KaXt+avgpQZKSdvxeqtuOmfdsRD2JRyDdsaer3S6MA+8JR+dONQAluaYIh1sToGnJ+h7nDXwMyusDCsdH3GB53v/MvVlfh77rQlskDAYIWEwQr/R7zNme/ZC++EXvle60TYF3rV0gdLPOX8Dz9Ap88yae1J/dIvSn0zh9fyjVUp7GmbBO9HQq3Sp2QFeMptetz0Qc4H3qGNFW4/bz+5X+vHGX8B7t/JnpfdPtoE3H6fP4umqi+DFM4bSxw92gScjgxESBiP0zoIXYd648xtaFv4aqoGDDRMN9+klXL6Gl21KWwycJkpcEaWvjpWB5x6ipbU1ilPYqpO8jAU7njWTF96WAe+R9kvQNmvkD4eqwZsYvI2uH8Jlfjqf+mNE0YtV0Dldv6OXF6L/C3vw+25tW6BzXCgFT0YGIyQMRkgYjNDveek9mKgXW6hcUVaxBAcvBmnJZlixPLCr9orS54a2g2ebogm/qHUOvPN3n1Ta+8UB8Np2jCl98YoHPO+b1M/Q21himf2rBNq6nfqaXTWDZ72a07c/wNKKx6J0jlW8D4YaC5Ve3orf6WzOJXT8Ny1WS33xfI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sJghITBCAmDERIGIyQMRkgYjPgbXyGH6ztag3kAAAAASUVORK5CYII=\" id=\"image84dbe55079\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"263.642553\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_18\">\n    <path d=\"M 263.642553 106.989543 \nL 263.642553 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_19\">\n    <path d=\"M 334.876596 106.989543 \nL 334.876596 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_20\">\n    <path d=\"M 263.642553 106.989543 \nL 334.876596 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_21\">\n    <path d=\"M 263.642553 35.7555 \nL 334.876596 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_4\">\n    <!-- sandal -->\n    <g transform=\"translate(279.501762 16.318125) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(113.378906 0)\"/>\n     <use xlink:href=\"#DejaVuSans-64\" transform=\"translate(176.757812 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(240.234375 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(301.513672 0)\"/>\n    </g>\n    <!-- sneaker -->\n    <g transform=\"translate(275.547387 29.7555) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(115.478516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(177.001953 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(238.28125 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(292.566406 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(354.089844 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_5\">\n   <g id=\"patch_22\">\n    <path d=\"M 349.123404 106.989543 \nL 420.357447 106.989543 \nL 420.357447 35.7555 \nL 349.123404 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#pb44ec5dbe2)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAGQ0lEQVR4nO2cS2xUVRjHz52503n0QUsftNLSMm3DQ6QVGltFULExxoSICVgiLFg1kZgYxXSjqIkhutOVQUNEFgTjRl2IxIgh0UCQ8GgoEEpBpjBQOkzpazozncd1d777vzqTWm37Lb7f6jvzv517kv+c75z7nXNrdBrbLCWwwLXQHRAIMYMRYgYjxAxGiBmMEDMYIWYwQsxghJjBCDGDEWIGI8QMRogZjBAzGCFmMELMYISYwQgxgxFiBiPEDEaIGYwQMxghZjBCzGCEOS83qV2q42TzEhRtR+g8I1MguUYmdJy+E56TvtkZ29UB7XgF/VZrfh8HzRVP6TgWXASaL5L4x+uUUioTKNCxcboXv/Nf9leYQ8QMRhj5ztq61q6E9s3tZTpetO4BaDvqz+l4nf8WaMUuGrZBMw3ahJXVccIyQEtYbh3XubOgbTjTrePlb46Alg7fVbNh/QW8x86yMzr2GRnQGsyAjt0G/qaTFqWmTx60gPZB5RUdb9rTDZqMDEaIGYwQMxhhPL/hI5gzwnsppz+3bAAuLvXQ0tPjyKFug/JtxkKPfa5UTq3YbVsGGpizp7K0DMw6/q7MjOl4S2E/a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EacMbcbfUHKVld7DnNGgyMhghZjBCzGDEvLx6PFOcZQwrTfm2/lWsfk4eD+p4sAsPPltxPKi2Z+MJHQcLsKIbSVO5wnlgOpSkEyhPF10DLZGl3cWUwvsNtZfqeGMAT6rsev8dlQsZGYwQMxix8GnK9kRuT0tKYdpyakUv3tTx5wNXQeuNL4P2sXtrdPxs1XXQ7O9dOF8Vi6bogMTpWDNoY2naXCrzYNV2MkPL7gnfIGi+MTxfa0dGBiPEDEaIGYxY8HJIvnlhtowda4J2YQEdoB75HncIK89TvjevYn7PTtB/9cnXN/cKvF+0nd6FHMWpRjXswxKIHRkZjBAzGLHgaUogZGQwQsxghJjBCDGDEWIGI8QMRogZjBAzGCFmMELMYISYwQgxgxFiBiPEDEaIGYwQMxghZjBCzGCEmMEIMYMRYgYjxAxGiBmMEDMY8RcK56JPKLelpAAAAABJRU5ErkJggg==\" id=\"imagecca958bb00\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"349.123404\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_23\">\n    <path d=\"M 349.123404 106.989543 \nL 349.123404 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_24\">\n    <path d=\"M 420.357447 106.989543 \nL 420.357447 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_25\">\n    <path d=\"M 349.123404 106.989543 \nL 420.357447 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_26\">\n    <path d=\"M 349.123404 35.7555 \nL 420.357447 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_5\">\n    <!-- ankle boot -->\n    <g transform=\"translate(353.017301 16.318125) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-62\" d=\"M 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\nM 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2969 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-61\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(61.279297 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(124.658203 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(182.568359 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(210.351562 0)\"/>\n     <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(271.875 0)\"/>\n     <use xlink:href=\"#DejaVuSans-62\" transform=\"translate(303.662109 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(367.138672 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(428.320312 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(489.501953 0)\"/>\n    </g>\n    <!-- sneaker -->\n    <g transform=\"translate(361.028238 29.7555) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(115.478516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(177.001953 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(238.28125 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(292.566406 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(354.089844 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_6\">\n   <g id=\"patch_27\">\n    <path d=\"M 434.604255 106.989543 \nL 505.838298 106.989543 \nL 505.838298 35.7555 \nL 434.604255 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p1a04e78912)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAJ6klEQVR4nO1dS48cVxWuV1c/Z/o5j8STMTN+gbGd4BArCRAGKQYlskQWWXiHIIDYZIHYseUPoGyIxBKBnEg8hIQUJSCD4ihBsS1wTOzxeJix55Fh3D39flXXg12d812rh6nWyLqD7rc6V6e67q0+dc8595xzb+kv6q8GmqTQLSukA9cdep1x6vPQ9jM2XvDRjT12qGM7eLR/jfFIe1PYFUoYEkEJQyJY//sSdvETM9QwUL/2jkyGtP3328Dz2+0RhqZpRj5PjWwG77m6RvRN7M88cRTa3ki9CxDsyeD80yGdWK3itdUG9f3gwZ67UDNDIihhSIRIaqrxzKGQziw3gLf5QjykD38w3A2NBKaaqs9MAWv87kpIW3OH8Xetzmj97ebKCrz66/T8/psF4DmZiZAee0upqQMJJQyJoIQhESLZDC9G7l3tZBZ4+oDRpgm88mvPhXSsg7rXcKkda/vAu3eB+nt8fht4y2fpnhfPXwHeb648D+2pD2ZpbNiF1s/pQ3n52z0a2637wNspj4X0uOA7m4PRwihqZkgEJQyJEElNcZVieDgVS/+iOX7uwzrw3v49W736uJJ1jnVDWt+OA6/0MV1r/HkCeInjxPvDpa8BLy4Eb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yTBvahWAXPc3h5HF/RGqNKt5S94U6XOGUOB5mEW0WFDoI9bw6K0bjLvhD2KevI6uZIRGUMCRCNDXFPzYrTE1jdSukvS/gh275R3kN8ZxwxuMRVE1D91EsFtC75Oq6BVSLVkdYrdt0H1/YRsYjumJtls5UE7+HpmlaYp19TFfbH6iZIRGUMCSCEoZEiGYzdnHh+EfIE9U5ZDKXUYyg8uIBUS+nr1OYwf0PfsHSff7JkF69gPszDv0NQx6J9z8NaXF7sXOW7BvfUqZpePqbmOlLfLz3rxnvFWpmSAQlDImwbytwjvRHK9CuL8yHdKwt1DQxbzJ++Qbw1n/0dEh/5wdLwDuRuBTSv9z4OvBefuUTaA8CUjFv/O4C8OZ+dj2k+984A7xegX6XWcNiBa9a1fYbamZIBCUMiaCEIRH0F/VX9yfkuGsvFIIInkW9zMMh915CF3Xxe78I6W/dQl2//I+Zod0Fwit29Mx6SP/6+FvAe/btn4T0E++ha5u8T4Vy3qd3hva3X1AzQyIoYUiER6Om9oid7z4H7cl36RB1d2NTvHxfYKQp4uu327tcuQt0IUGmTkg4+FDCkAhKGBLhvwkbBgo7p0pXAAAAAElFTkSuQmCC\" id=\"image9f2d3023fe\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"434.604255\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_28\">\n    <path d=\"M 434.604255 106.989543 \nL 434.604255 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_29\">\n    <path d=\"M 505.838298 106.989543 \nL 505.838298 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_30\">\n    <path d=\"M 434.604255 106.989543 \nL 505.838298 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_31\">\n    <path d=\"M 434.604255 35.7555 \nL 505.838298 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_6\">\n    <!-- coat -->\n    <g transform=\"translate(457.221902 16.318125) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-63\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(54.980469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(116.162109 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(177.441406 0)\"/>\n    </g>\n    <!-- pullover -->\n    <g transform=\"translate(445.895027 29.7555) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-70\"/>\n     <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(63.476562 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(126.855469 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(154.638672 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(182.421875 0)\"/>\n     <use xlink:href=\"#DejaVuSans-76\" transform=\"translate(243.603516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(302.783203 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(364.306641 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_7\">\n   <g id=\"patch_32\">\n    <path d=\"M 520.085106 106.989543 \nL 591.319149 106.989543 \nL 591.319149 35.7555 \nL 520.085106 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p5f45a863cc)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAIvUlEQVR4nO1d3W9c1RE/98u7/ozj2InjOEAgKRBKKV8pFFSEmlCJogJtKuUBeKyKkKBSH/o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ce/9UJvxPwoVhiC0rabSf5yA8ZHKDkuPsCgqjZTydjB6k049xeVQFULdXGNQbY2GqDL5vbZ5l1JSd5pHAOicZxrZEeWzTVRhkwePuWdkznw1dGcIggpDEFQYgtCxWtu/fHGTpX9x02HgnVhx77cYCDELSDN9vC2Y6uy8Pr0/zmFk9P5RdCe5W0xBX+0zmOP28rXtLJ6z9MGZB4FXqM5kzpcH3RmCoMIQhDWpKb/okjhJDd/cVXx92NITv8RkCwW/+JFuf34aprW3PClEix6uH7wAPO5aX2pm329Ak2T88jHq9n6NqCVjjNkckBa3F9DtNWbGkWt4Ca/uDEFQYQiCCkMQvL3e/o5fMlZ7ZA+Mqz8tWfrxaz4B3l2kDpffhDZL3pFxLcumnY6dnuZR001+dvbucPkWGE+St10O+WgHr5B63ndKu4F39OA3LX1VoRq9ymINV1fozhAEFYYgrE1NUTfNY3Js8yaZ5QP3WLp8AF+n8Mptrsjhb5Wbgbc9umTpbzE1VWUn7vdIQcQT7DaFn8+50/N7b9wOvB1/cPVezVOzptvQnSEIKgxBUGEIQvuubc4x34swY5bGGGZY9RTkRpq3ZrHoICFFD3GK9qrgZUd5fnD/4zBu1xZAaKiBrWl6E9v/AVQYgtCxy7+AlaeW+EWLOVuaXoKy++VngPftfa4g4mIdo7J9Ic7/0T93WXrXqb+vfm056+RR605Ad4YgqDAEQYUhCF8CqGizT9eDoPYAAAAASUVORK5CYII=\" id=\"imagebe00c9175e\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"520.085106\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_33\">\n    <path d=\"M 520.085106 106.989543 \nL 520.085106 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_34\">\n    <path d=\"M 591.319149 106.989543 \nL 591.319149 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_35\">\n    <path d=\"M 520.085106 106.989543 \nL 591.319149 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_36\">\n    <path d=\"M 520.085106 35.7555 \nL 591.319149 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_7\">\n    <!-- shirt -->\n    <g transform=\"translate(542.288378 16.318125) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n      <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-68\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(115.478516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(143.261719 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(184.375 0)\"/>\n    </g>\n    <!-- t-shirt -->\n    <g transform=\"translate(537.771503 29.7555) scale(0.12 -0.12)\">\n     <defs>\n      <path id=\"DejaVuSans-2d\" d=\"M 313 2009 \nL 1997 2009 \nL 1997 1497 \nL 313 1497 \nL 313 2009 \nz\n\" transform=\"scale(0.015625)\"/>\n     </defs>\n     <use xlink:href=\"#DejaVuSans-74\"/>\n     <use xlink:href=\"#DejaVuSans-2d\" transform=\"translate(39.208984 0)\"/>\n     <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(75.292969 0)\"/>\n     <use xlink:href=\"#DejaVuSans-68\" transform=\"translate(127.392578 0)\"/>\n     <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(190.771484 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(218.554688 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(259.667969 0)\"/>\n    </g>\n   </g>\n  </g>\n  <g id=\"axes_8\">\n   <g id=\"patch_37\">\n    <path d=\"M 605.565957 106.989543 \nL 676.8 106.989543 \nL 676.8 35.7555 \nL 605.565957 35.7555 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p5bb162e616)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAGMAAABjCAYAAACPO76VAAAGuUlEQVR4nO2cW2xURRjH55yzt263pXTphVuhKTd9AjEVAW9AhBBDNHh5MEHUGOMbJt7iC9EXDQE1JuKDlycfiMQIqAlGTEwhYERUqKIIpkVKXbDQtd2Ws7vn4tvM/IecExZT/CDf7+k7+e/uzPbf+Wb2OzPHWmU9GAqGBPb/3QFGwWYQgs0gBJtBCDaDEGwGIdgMQrAZhGAzCMFmEILNIASbQQg2gxBsBiHYDEKwGYRgMwiRiFUtC69DmjcFrQR+DTtXjy9wHO3FxnfyPBUH+P1C7ftaxvuCcjn6fb4f3dkgWuORQQg2gxDxaSomLZmpwemYIeORhW2gjcxUaSJI4ecEMT3InlPtT+org5buG5Kx1/8naH7xn+gPjcHOZuE6rKoUZucng+Y05LTO4JcKk+pLBQ0ZbGPUVf08cQq12rrLTCRsBiHYDEJclrGdKXkZn3l8Pmhd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A6ktj+BV+V99dmz4C24rXnZNy6/SBoPDIIwWYQYmLSVBw2bmSwU8mIFwoRuG6kpjP4wlK47t20Ha71vbdFH/fh1hsb3nTilrb654wEdaDltbue63N493L1tIWR7fHIIASbQQg2gxDxZ/omAuPobeDGHNPV55e4I7tG2u/87Cm43nzXbhk32DgP6UtWszSil1F8o/yjL4Mb7Uug6WdQetwr/3/nkUEINoMQ1z5N1UJMatJpfwt/yXb1tMD1xkZVOf24hBsb9F/g5iY6R9sjrB93EwKXumc8rDYvSBVkfMSdFdt3HR4ZhGAzCMFmEIL2nHGVlF7EM3a3LHxGxntf3grartJcGbvGszRg54hRiNbPnDQYS9sLgSqVDFTwqHMcPDIIwWYQ4rpNU1ZSpRT9SQZCCGEdOgrXO3cckPE3l6aDpv9arhpHmPWzJCljs5t+5CxjY0V3eUb9yt89bDyITEQ/2YFHBiHYDEKwGYS4bucMc56I46Nit4wnJXBDQqCVOeakC6AtzvTLuCnmjuBXY7jxeWXvShm7O/GpdHmBj6jQ4ZFBCDaDENd+Q8IEYD680txj5a1YLONtH+BmhaK2meDuOtw39XxhkYw/OdgNWuenqo3E13gc7GrhkUEINoMQbAYhbog5o5Zntj/8Ky5fX9+jztXNefUYaMHY2H/vWw3wyCAEm0GIGyNN3SDwyCAEm0EINoMQbAYh2AxCsBmEYDMIwWYQgs0gBJtBCDaDEGwGIdgMQrAZhGAzCMFmEILNIMS/eY7R76vYyXAAAAAASUVORK5CYII=\" id=\"imagea0fa55dc04\" transform=\"scale(1 -1) translate(0 -71.28)\" x=\"605.565957\" y=\"-35.709543\" width=\"71.28\" height=\"71.28\"/>\n   </g>\n   <g id=\"patch_38\">\n    <path d=\"M 605.565957 106.989543 \nL 605.565957 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_39\">\n    <path d=\"M 676.8 106.989543 \nL 676.8 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_40\">\n    <path d=\"M 605.565957 106.989543 \nL 676.8 106.989543 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_41\">\n    <path d=\"M 605.565957 35.7555 \nL 676.8 35.7555 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_8\">\n    <!-- sneaker -->\n    <g transform=\"translate(617.470791 16.318125) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-73\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(52.099609 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(115.478516 0)\"/>\n     <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(177.001953 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(238.28125 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(292.566406 0)\"/>\n     <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(354.089844 0)\"/>\n    </g>\n    <!-- ankle boot -->\n    <g transform=\"translate(609.459854 29.7555) scale(0.12 -0.12)\">\n     <use xlink:href=\"#DejaVuSans-61\"/>\n     <use xlink:href=\"#DejaVuSans-6e\" transform=\"translate(61.279297 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6b\" transform=\"translate(124.658203 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(182.568359 0)\"/>\n     <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(210.351562 0)\"/>\n     <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(271.875 0)\"/>\n     <use xlink:href=\"#DejaVuSans-62\" transform=\"translate(303.662109 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(367.138672 0)\"/>\n     <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(428.320312 0)\"/>\n     <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(489.501953 0)\"/>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p7423ef18c5\">\n   <rect x=\"7.2\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"p81be0dca2b\">\n   <rect x=\"92.680851\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"p873ebcf63c\">\n   <rect x=\"178.161702\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"pb80d041591\">\n   <rect x=\"263.642553\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"pb44ec5dbe2\">\n   <rect x=\"349.123404\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"p1a04e78912\">\n   <rect x=\"434.604255\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"p5f45a863cc\">\n   <rect x=\"520.085106\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n  <clipPath id=\"p5bb162e616\">\n   <rect x=\"605.565957\" y=\"35.7555\" width=\"71.234043\" height=\"71.234043\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {}
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-14 fw=all -->\n",
    "\n",
    "The gallery shows *which* images fail; to see *how* they fail in aggregate we\n",
    "compute the confusion matrix introduced in that section. We\n",
    "accumulate a $10\\times10$ matrix of counts over the validation set, with entry\n",
    "$(i, j)$ counting how often true class $j$ was predicted as class $i$, and then\n",
    "normalize each column so that column $j$ shows the distribution of predictions\n",
    "for class $j$ (classes are indexed in the order of `text_labels`: t-shirt,\n",
    "trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, ankle boot).\n",
    "\n",
    "To display that matrix of counts as a grid of colored cells rather than a\n",
    "wall of numbers, we define `show_heatmaps`, a display utility we reuse\n",
    "throughout the book (e.g., for visualizing attention weights)."
   ]
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-prediction-3"
   },
   "source": [
    "\n",
    "def show_heatmaps(matrices, xlabel, ylabel, titles=None, figsize=(2.5, 2.5),\n",
    "                  cmap='Reds'):\n",
    "    \"\"\"Show heatmaps of matrices.\"\"\"\n",
    "    d2l.use_svg_display()\n",
    "    num_rows, num_cols, _, _ = matrices.shape\n",
    "    fig, axes = d2l.plt.subplots(num_rows, num_cols, figsize=figsize,\n",
    "                                 sharex=True, sharey=True, squeeze=False)\n",
    "    for i, (row_axes, row_matrices) in enumerate(zip(axes, matrices)):\n",
    "        for j, (ax, matrix) in enumerate(zip(row_axes, row_matrices)):\n",
    "            pcm = ax.imshow(d2l.numpy(matrix), cmap=cmap)\n",
    "            if i == num_rows - 1:\n",
    "                ax.set_xlabel(xlabel)\n",
    "            if j == 0:\n",
    "                ax.set_ylabel(ylabel)\n",
    "            if titles:\n",
    "                ax.set_title(titles[j])\n",
    "    fig.colorbar(pcm, ax=axes, shrink=0.6);"
   ],
   "execution_count": 15,
   "outputs": []
  },
  {
   "cell_type": "code",
   "metadata": {
    "id": "softmax-regression-scratch-prediction-confusion"
   },
   "source": [
    "C = torch.zeros(10, 10)\n",
    "for X_i, y_i in data.val_dataloader():\n",
    "    with torch.no_grad():\n",
    "        preds_i = model(X_i).argmax(axis=1)\n",
    "    C += torch.bincount(10 * preds_i + y_i, minlength=100).reshape(10, 10)\n",
    "C /= C.sum(axis=0, keepdims=True)              # column j: true class j\n",
    "d2l.show_heatmaps(C.reshape(1, 1, 10, 10), xlabel='true class',\n",
    "                  ylabel='predicted class', figsize=(3.5, 3.5), cmap='Blues')"
   ],
   "execution_count": 16,
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"236.16995pt\" height=\"200.99625pt\" viewBox=\"0 0 236.16995 200.99625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2026-07-19T13:49:33.979631</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.8, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 200.99625 \nL 236.16995 200.99625 \nL 236.16995 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 34.240625 163.44 \nL 190.480625 163.44 \nL 190.480625 7.2 \nL 34.240625 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g clip-path=\"url(#p295f95b610)\">\n    <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAANkAAADZCAYAAACtvpV2AAAEE0lEQVR4nO3cMY+lcxiH4efMnJ2xFtlZzXYalUZFo1CJSsmnIKJQERWNQkOn8A0k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/XwZnf2bmzsvvLL758KfPF9+cmWn+QHOxi/3jJYOYyCAmMoiJDGIig5jIICYyiIkMYiKDmMggJjKIiQxiIoOYyCAmMoiJDGIig5jIICYyiIkMYus7b36ZDBdHb66jizcO6cz88uCvZPf5u08lu/vESwYxkUFMZBATGcREBjGRQUxkEBMZxEQGMZFBTGQQExnERAYxkUFMZBATGcREBjGRQUxkEBMZxEQGsX8A1vN3BnMwBicAAAAASUVORK5CYII=\" id=\"imageb2f9e54136\" transform=\"scale(1 -1) translate(0 -156.24)\" x=\"34.240625\" y=\"-7.2\" width=\"156.24\" height=\"156.24\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <defs>\n       <path id=\"mbda5cd917f\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mbda5cd917f\" x=\"42.052625\" y=\"163.44\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0 -->\n      <g transform=\"translate(38.871375 178.038437) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#mbda5cd917f\" x=\"73.300625\" y=\"163.44\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 2 -->\n      <g transform=\"translate(70.119375 178.038437) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#mbda5cd917f\" x=\"104.548625\" y=\"163.44\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 4 -->\n      <g transform=\"translate(101.367375 178.038437) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#mbda5cd917f\" x=\"135.796625\" y=\"163.44\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 6 -->\n      <g transform=\"translate(132.615375 178.038437) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#mbda5cd917f\" x=\"167.044625\" y=\"163.44\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 8 -->\n      <g transform=\"translate(163.863375 178.038437) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \nQ 1584 2216 1326 1975 \nQ 1069 1734 1069 1313 \nQ 1069 891 1326 650 \nQ 1584 409 2034 409 \nQ 2484 409 2743 651 \nQ 3003 894 3003 1313 \nQ 3003 1734 2745 1975 \nQ 2488 2216 2034 2216 \nz\nM 1403 2484 \nQ 997 2584 770 2862 \nQ 544 3141 544 3541 \nQ 544 4100 942 4425 \nQ 1341 4750 2034 4750 \nQ 2731 4750 3128 4425 \nQ 3525 4100 3525 3541 \nQ 3525 3141 3298 2862 \nQ 3072 2584 2669 2484 \nQ 3125 2378 3379 2068 \nQ 3634 1759 3634 1313 \nQ 3634 634 3220 271 \nQ 2806 -91 2034 -91 \nQ 1263 -91 848 271 \nQ 434 634 434 1313 \nQ 434 1759 690 2068 \nQ 947 2378 1403 2484 \nz\nM 1172 3481 \nQ 1172 3119 1398 2916 \nQ 1625 2713 2034 2713 \nQ 2441 2713 2670 2916 \nQ 2900 3119 2900 3481 \nQ 2900 3844 2670 4047 \nQ 2441 4250 2034 4250 \nQ 1625 4250 1398 4047 \nQ 1172 3844 1172 3481 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_6\">\n     <!-- true class -->\n     <g transform=\"translate(88.098906 191.716563) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \nQ 2534 3019 2420 3045 \nQ 2306 3072 2169 3072 \nQ 1681 3072 1420 2755 \nQ 1159 2438 1159 1844 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1341 3275 1631 3429 \nQ 1922 3584 2338 3584 \nQ 2397 3584 2469 3576 \nQ 2541 3569 2628 3553 \nL 2631 2963 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-75\" d=\"M 544 1381 \nL 544 3500 \nL 1119 3500 \nL 1119 1403 \nQ 1119 906 1312 657 \nQ 1506 409 1894 409 \nQ 2359 409 2629 706 \nQ 2900 1003 2900 1516 \nL 2900 3500 \nL 3475 3500 \nL 3475 0 \nL 2900 0 \nL 2900 538 \nQ 2691 219 2414 64 \nQ 2138 -91 1772 -91 \nQ 1169 -91 856 284 \nQ 544 659 544 1381 \nz\nM 1991 3584 \nL 1991 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \nL 3122 2828 \nQ 2878 2963 2633 3030 \nQ 2388 3097 2138 3097 \nQ 1578 3097 1268 2742 \nQ 959 2388 959 1747 \nQ 959 1106 1268 751 \nQ 1578 397 2138 397 \nQ 2388 397 2633 464 \nQ 2878 531 3122 666 \nL 3122 134 \nQ 2881 22 2623 -34 \nQ 2366 -91 2075 -91 \nQ 1284 -91 818 406 \nQ 353 903 353 1747 \nQ 353 2603 823 3093 \nQ 1294 3584 2113 3584 \nQ 2378 3584 2631 3529 \nQ 2884 3475 3122 3366 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-74\"/>\n      <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(39.208984 0)\"/>\n      <use xlink:href=\"#DejaVuSans-75\" transform=\"translate(80.322266 0)\"/>\n      <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(143.701172 0)\"/>\n      <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(205.224609 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(237.011719 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(291.992188 0)\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(319.775391 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(381.054688 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(433.154297 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_6\">\n      <defs>\n       <path id=\"me003800162\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#me003800162\" x=\"34.240625\" y=\"15.012\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 0 -->\n      <g transform=\"translate(20.878125 18.811219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_7\">\n      <g>\n       <use xlink:href=\"#me003800162\" x=\"34.240625\" y=\"46.26\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 2 -->\n      <g transform=\"translate(20.878125 50.059219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#me003800162\" x=\"34.240625\" y=\"77.508\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 4 -->\n      <g transform=\"translate(20.878125 81.307219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_9\">\n      <g>\n       <use xlink:href=\"#me003800162\" x=\"34.240625\" y=\"108.756\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_10\">\n      <!-- 6 -->\n      <g transform=\"translate(20.878125 112.555219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#me003800162\" x=\"34.240625\" y=\"140.004\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 8 -->\n      <g transform=\"translate(20.878125 143.803219) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_12\">\n     <!-- predicted class -->\n     <g transform=\"translate(14.798438 123.037969) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \nL 2906 4863 \nL 3481 4863 \nL 3481 0 \nL 2906 0 \nL 2906 525 \nQ 2725 213 2448 61 \nQ 2172 -91 1784 -91 \nQ 1150 -91 751 415 \nQ 353 922 353 1747 \nQ 353 2572 751 3078 \nQ 1150 3584 1784 3584 \nQ 2172 3584 2448 3432 \nQ 2725 3281 2906 2969 \nz\nM 947 1747 \nQ 947 1113 1208 752 \nQ 1469 391 1925 391 \nQ 2381 391 2643 752 \nQ 2906 1113 2906 1747 \nQ 2906 2381 2643 2742 \nQ 2381 3103 1925 3103 \nQ 1469 3103 1208 2742 \nQ 947 2381 947 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-70\"/>\n      <use xlink:href=\"#DejaVuSans-72\" transform=\"translate(63.476562 0)\"/>\n      <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(102.339844 0)\"/>\n      <use xlink:href=\"#DejaVuSans-64\" transform=\"translate(163.863281 0)\"/>\n      <use xlink:href=\"#DejaVuSans-69\" transform=\"translate(227.339844 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(255.123047 0)\"/>\n      <use xlink:href=\"#DejaVuSans-74\" transform=\"translate(310.103516 0)\"/>\n      <use xlink:href=\"#DejaVuSans-65\" transform=\"translate(349.3125 0)\"/>\n      <use xlink:href=\"#DejaVuSans-64\" transform=\"translate(410.835938 0)\"/>\n      <use xlink:href=\"#DejaVuSans-20\" transform=\"translate(474.3125 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(506.099609 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" transform=\"translate(561.080078 0)\"/>\n      <use xlink:href=\"#DejaVuSans-61\" transform=\"translate(588.863281 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(650.142578 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(702.242188 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 34.240625 163.44 \nL 34.240625 7.2 \n\" 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 190.480625 163.44 \nL 190.480625 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 34.240625 163.44 \nL 190.480625 163.44 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 34.240625 7.2 \nL 190.480625 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n  <g id=\"axes_2\">\n   <g id=\"patch_7\">\n    <path d=\"M 200.245625 143.532 \nL 206.066825 143.532 \nL 206.066825 27.108 \nL 200.245625 27.108 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <image xlink:href=\"data:image/png;base64,\niVBORw0KGgoAAAANSUhEUgAAAAgAAACiCAYAAAB8iIwDAAAA6klEQVR4nO2Xyw6FMAhEa+L/f+5dmD5cuOeQDJBeo9siHGag0eN3rdWM51zNPG+n/b4vAEpMzJAPOQkSEkS0CV3uAanbjZDYpkMoCPggn4AASHk3/wJyoBd6BoJEoVAHzKC3yZDcJpTAvcAuHJDAMIGSdxMhA0aOIHkeQAh2EzM4IPMzsA7pkOhmz5+HTmbpqxcwtPJUB1yk7KY6UQFXsS5UPqRjL1QlA4SSIQsyOEqY50VtIoN9BwWUGGMHLyggwAtQkr+rKUMBpC5UhQ4buKmXWCwUBcyhBugl8HeygIEDELJDgN7mG7y4AbS8jTcZ9oUvAAAAAElFTkSuQmCC\" id=\"imagea57a8a15f6\" transform=\"scale(1 -1) translate(0 -116.64)\" x=\"200.16\" y=\"-26.64\" width=\"5.76\" height=\"116.64\"/>\n   <g id=\"matplotlib.axis_3\"/>\n   <g id=\"matplotlib.axis_4\">\n    <g id=\"ytick_6\">\n     <g id=\"line2d_11\">\n      <defs>\n       <path id=\"m44c5686a39\" d=\"M 0 0 \nL 3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m44c5686a39\" x=\"206.066825\" y=\"143.532\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.0 -->\n      <g transform=\"translate(213.066825 147.331219) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_7\">\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m44c5686a39\" x=\"206.066825\" y=\"119.047457\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.2 -->\n      <g transform=\"translate(213.066825 122.846676) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_8\">\n     <g id=\"line2d_13\">\n      <g>\n       <use xlink:href=\"#m44c5686a39\" x=\"206.066825\" y=\"94.562914\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.4 -->\n      <g transform=\"translate(213.066825 98.362132) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-34\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_9\">\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m44c5686a39\" x=\"206.066825\" y=\"70.07837\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 0.6 -->\n      <g transform=\"translate(213.066825 73.877589) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-36\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_10\">\n     <g id=\"line2d_15\">\n      <g>\n       <use xlink:href=\"#m44c5686a39\" x=\"206.066825\" y=\"45.593827\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_17\">\n      <!-- 0.8 -->\n      <g transform=\"translate(213.066825 49.393046) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n   </g>\n   <g id=\"LineCollection_1\"/>\n   <g id=\"patch_8\">\n    <path d=\"M 200.245625 143.532 \nL 203.156225 143.532 \nL 206.066825 143.532 \nL 206.066825 27.108 \nL 203.156225 27.108 \nL 200.245625 27.108 \nL 200.245625 143.532 \nz\n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p295f95b610\">\n   <rect x=\"34.240625\" y=\"7.2\" width=\"156.24\" height=\"156.24\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {}
    }
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-15 fw=all -->\n",
    "\n",
    "The errors are anything but uniform: they form two blocks. Upper-body garments\n",
    "(t-shirt, pullover, dress, coat, shirt: columns 0, 2, 3, 4, 6) are traded\n",
    "almost exclusively among themselves, with the *shirt* column the most polluted\n",
    "of all as it leaks into t-shirt, pullover, and coat; and footwear (sandal,\n",
    "sneaker, ankle boot: columns 5, 7, 9) forms a second, smaller cluster.\n",
    "Meanwhile trousers and bags are nearly pure diagonal: their overall silhouette\n",
    "is unmistakable even to a linear model. This is the summary's claim made\n",
    "visible, since to a classifier that can only weigh pixels linearly, two\n",
    "garments with the same outline and mass distribution, like a shirt and a\n",
    "pullover, are close to indistinguishable, while classes that differ in\n",
    "silhouette are easy.\n",
    "\n",
    "## Summary and Discussion\n",
    "\n",
    "In this section we built softmax regression entirely from scratch: the softmax\n",
    "operation, the cross-entropy loss, parameter initialization, the forward pass, and\n",
    "training on Fashion-MNIST. Breaking each piece open by hand is the purpose. Once\n",
    "you have seen these five moving parts separately, the one-liner in\n",
    "that section is just notation.\n",
    "\n",
    "**What the training curve tells you.** After 10 epochs with minibatch SGD the\n",
    "model converges to roughly 82--83% validation accuracy. That ceiling is the\n",
    "limit of linear separability on Fashion-MNIST, not a tuning artifact.\n",
    "The ten classes are not linearly separable in pixel space (shirts and pullovers\n",
    "look nearly identical to a linear model). The misclassification gallery and the\n",
    "confusion matrix at the end of the section make this concrete. Replacing the flat linear layer with\n",
    "even a single hidden layer (that section) pushes past it.\n",
    "\n",
    "**Why the clip is only a band-aid.** The clip stops $\\log 0$ but leaves the naive\n",
    "`softmax` free to overflow for large logits; the real fix (subtracting the row\n",
    "maximum before exponentiating and fusing softmax with log) is derived in\n",
    "that section, which the concise\n",
    "implementation applies automatically.\n",
    "\n",
    "## Exercises\n",
    "\n",
    "1. In this section, we directly implemented the softmax function based on the mathematical definition of the softmax operation. As discussed in that section this can cause numerical instabilities.\n",
    "    1. Test whether `softmax` still works correctly if an input has a value of $100$.\n",
    "    1. Test whether `softmax` still works correctly if the largest of all inputs is smaller than $-100$.\n",
    "    1. Implement a fix by looking at the value relative to the largest entry in the argument.\n",
    "1. Implement a `cross_entropy` function that follows the definition of the cross-entropy loss function $-\\sum_i y_i \\log \\hat{y}_i$.\n",
    "    1. Try it out in the code example of this section.\n",
    "    1. Why do you think it runs more slowly?\n",
    "    1. Should you use it? When would it make sense to?\n",
    "    1. What do you need to be careful of? Hint: consider the domain of the logarithm.\n",
    "1. Is it always a good idea to return the most likely label? For example, would you do this for medical diagnosis? How would you try to address this?\n",
    "1. Assume that we want to use softmax regression to predict the next word based on some features. What are some problems that might arise from a large vocabulary?\n",
    "1. Experiment with the hyperparameters of the code in this section. In particular:\n",
    "    1. Plot how the validation loss changes as you change the learning rate.\n",
    "    1. Do the validation and training loss change as you change the minibatch size? How large or small do you need to go before you see an effect?\n",
    "1. The diagonal of the (column-normalized) confusion matrix is the *per-class accuracy*. Read it off the matrix computed above. Which class is hardest, and which pairs of classes account for most of the errors? Why would a *linear* model struggle on exactly those pairs, and why should replacing it with a model that can respond to localized shape cues (a collar, a heel) help?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!-- d2l:prose id=softmax-regression-scratch-md-16 fw=pytorch -->\n",
    "\n",
    "[Discussions](https://d2l.discourse.group/t/51)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "d2l-pytorch",
   "display_name": "d2l (PyTorch)",
   "language": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
