Introduction to deep learning · Which shipment gets tomorrow’s inspection slot?
Start here
Lesson route
- Freeze the inputs
- Read the neuron
- Measure the error
- Update one parameter
- Test the ranking
The lecture builds from a multi-output perceptron to training a network and later introduces early stopping. In the first Python lab, gradients connect a computed loss to trainable parameters. The shipping calculation below isolates one weight so that change can be audited by hand. Slides · PDF 36 · Companion lab
Original GuideWit example. The figures illustrate the exercise. The linked times open related sections of the MIT lecture.
Freeze the inputs
Let x = 2 be the missed checkpoints by noon and y = 1 the later observation of lateness. Arrival time may establish the label after delivery. Putting it into the input would let the model see the answer during training.
Freeze the inputs · x = 2 → y = 1 → t₀ < t₁. 15:40 · MIT 6.S191
Read the neuron
The input weight is 0.4 and the bias is −1. Multiplying and adding gives z = −0.2. The sigmoid maps this to 0.4502. A score below one half can still belong to a shipment that arrives late.
Read the neuron · 0.4 × 2 − 1 → −0.2 → σ ≈ 0.450. 27:36 · MIT 6.S191
Measure the error
Because this shipment was late, its binary cross-entropy is −ln(0.4502), about 0.798. An on-time shipment would use −ln(1−p). Crossing a classification threshold and reducing the training loss are separate events.
Measure the error · y = 1 → −ln(0.450) → ≈ 0.798. 30:44 · MIT 6.S191
Update one parameter
Hold the bias fixed. The gradient of this loss with respect to the weight is (p−y)x ≈ −1.100. Subtract 0.1 times that value. The weight rises to 0.510, giving a probability near 0.505 and loss near 0.683.
Update one parameter · −1.100 → 0.4 + 0.110 → w ≈ 0.510. 35:54 · MIT 6.S191
Test the ranking
An on-time shipment with the same input receives the same increase in score. Evaluate the first ten alerts on later shipments, keeping all records of a journey together. Count how many calls catch a genuinely late delivery.
Test the ranking · 0.450 → 0.505 → y = 1: L ↓ → y = 0: L ↑. 45:59 · MIT 6.S191
Worked comparison
Weight | Probability and loss |
|---|---|
0.4 | 0.450 / 0.798 |
0.510 | 0.505 / 0.683 |
Troubleshooting
Signal | Check |
|---|---|
The score never moves | Check x and the learning rate |
Test results look perfect | Look for arrival fields dated after noon |
Practice
- Recalculate with x = 0 and the same bias. Which parameter can this row teach?
Answer · The weight gradient is zero. The bias can still move if it is trainable.
- Can a lower loss on this one shipment justify ten calls?
Answer · No. Use later labeled journeys to measure the ranking at the desk’s real call capacity.
Glossary
Weight = learned input multiplier. Bias = input-independent offset. Gradient = local sensitivity of the loss.