
- Backpropagation: the algorithm for computing gradients of the loss w.r.t. each weight by propagating error backward through the network.
- Chain rule: the calculus tool that decomposes derivatives of composite functions into products of simpler derivatives.
- Gradient descent: the optimization step that uses gradients to update weights and reduce error.


- Input layer: receives features (e.g., encoded genre, setting).
- Hidden layer(s): transform inputs and extract patterns.
- Output layer: yields final prediction (e.g., probability of watching a suggested show).
- Weights: connections between nodes that determine importance of each input.
| Component | Purpose | Example |
|---|---|---|
| Input layer | Accepts feature values | genre, setting |
| Hidden layer | Learns intermediate features | single neuron for illustration |
| Output layer | Produces probability or label | probability of watching “Heartstopper” |
| Weights | Parameters updated during training | w1, w2 |
| Loss function | Measures prediction error | 0.5*(y - t)^2 |

- Machine learning engineers: implement and train models.
- Data scientists: analyze and prepare feature data.
- AI researchers: design novel architectures and optimization techniques.
- Software engineers (AI-focused): integrate models into products.
| Role | Typical responsibilities |
|---|---|
| Machine learning engineer | Train, validate, deploy models |
| Data scientist | Feature engineering, experiments |
| AI researcher | New algorithms, theoretical work |
| Software engineer (AI) | Product integration, latency/perf |
- Two inputs: x1 (genre), x2 (setting)
- One hidden neuron (for clarity) and a sigmoid activation at the output
- Output y = sigmoid(s), where s = x1w1 + x2w2

- Inputs: x1, x2
- Weights: w1, w2
- Weighted sum: s = x1w1 + x2w2
- Activation (sigmoid): y = sigmoid(s) = 1 / (1 + exp(-s))

- x1 = 4.0 (encoded genre)
- x2 = 2.0 (encoded setting)
- initial weights: w1 = 0.2, w2 = 0.6

- dy/dw1 = (dy/ds) * (ds/dw1)
- dy/ds = y * (1 - y)
- ds/dw1 = x1
- dy/dw1 = x1 * y * (1 - y)
- dL/dy = (y - t)
- dL/dw1 = dL/dy * dy/dw1 = (y - t) * dy/dw1
- error = y - t ≈ 0.8808 - 0.65 = 0.2308
- dL/dw1 ≈ 0.2308 * 0.420 ≈ 0.0969

Backpropagation combines local derivatives: compute how a small change to a weight affects the node output, then multiply by how that output affects the loss. In practice this scales to many layers by repeatedly applying the chain rule from output back to inputs.
Choose the learning rate (
alpha) carefully. Too large -> divergence/overshooting; too small -> very slow learning. Also, scale and normalize inputs for stable training.- dz/dx = (dz/dy) * (dy/dx)
- dy/dx = 6x
- dz/dy = 3y^2
- dz/dx = 3y^2 * 6x = 18 x y^2

- y = x^3 - 2
- z = 2 - y^2
- dy/dx = 3x^2
- dz/dy = -2y
- dz/dx = dz/dy * dy/dx = (-2y) * (3x^2) = -6 x^2 y
- y = 1^3 - 2 = -1
- dz/dx = -6 * 1^2 * (-1) = 6

- Inner function: s = x1w1 + x2w2
- Outer function: y = sigmoid(s)
- Chain rule: dy/dw = (dy/ds) * (ds/dw)
- The sign and magnitude of dL/dw determine whether to increase or decrease each weight.

- Backpropagation = chain rule applied through network layers to compute gradients.
- Gradients show how each weight affects the loss; optimizers use them to update weights and reduce error.
- Repeating forward passes and backpropagation over many examples and epochs is how networks learn complex patterns.

- Chain rule (calculus): https://en.wikipedia.org/wiki/Chain_rule
- Backpropagation algorithm: https://en.wikipedia.org/wiki/Backpropagation
- Introduction to neural networks and training: https://www.deeplearningbook.org/ (Goodfellow, Bengio, Courville)