{
  "schema": "ml-prep/item@1",
  "item": {
    "id": "original-ml-forward-backprop",
    "area": "machine-learning",
    "topic": "neural-networks",
    "origin": "original",
    "title": "Forward pass and backpropagation",
    "skills": [
      "forward-pass",
      "activations",
      "chain-rule",
      "backpropagation"
    ],
    "priority": "core",
    "difficulty": "medium",
    "estimated_minutes": 8,
    "prerequisites": [
      "chain-rule"
    ],
    "prompt": "A scalar network has $h=\\operatorname{ReLU}(wx)$, $\\hat{y}=vh$, and loss\n\n$$L=\\frac{1}{2}(\\hat{y}-y)^2.$$\n\nAt $x=2$, $w=1$, $v=3$, and $y=4$, compute $h$, $\\hat{y}$, $L$, $\\frac{\\partial L}{\\partial v}$, and $\\frac{\\partial L}{\\partial w}$.\n",
    "answer": "$h=2$, $\\hat{y}=6$, and $L=2$. The derivatives are\n\n$$\\frac{\\partial L}{\\partial v}=(6-4)h=4$$\n\nand\n\n$$\\frac{\\partial L}{\\partial w}=(6-4)vx=12,$$\n\nbecause the ReLU input is positive.\n",
    "check": {
      "kind": "numeric",
      "id": "original-ml-forward-backprop",
      "values": [
        2,
        6,
        2,
        4,
        12
      ]
    }
  }
}