L07 | English F3 Student Learning Log
L07 | English F3 Student Learning Log
Persona: I'm a Form 3 (Grade 9) student and I only read English. I know basic Python (variables, for loops, lists) and school algebra up to quadratics. I learn from the official pages, the videos with captions, and the book. Kaggle notebook steps are written as a practice log that follows the official notebooks.
What I understood (in my own words)
- A recommendation system guesses 'will you like this?'. YouTube and Netflix both use them.
- We don't need to know whether a film is action or romance. The model learns numbers that represent tastes by itself (latent factors).
- Embedding sounds hard, but it's just using an ID number to look up a row in a big table.
- Softmax turns scores into probabilities that add up to exactly 100%.
- Weight decay is like a fine: big weights cost extra loss, so the model avoids extreme values.
Where I got stuck, and how I got unstuck
| Where I got stuck | How I solved it |
|---|---|
| Calculating powers of e | I used math.exp in Python, then divided each by the total. The answers matched the course spreadsheet. |
| What is −log? | I remember the shape: when the probability is near 1, the loss is near 0; the smaller the probability, the bigger the loss. |
| Python classes with init and forward | I reviewed classes first: init sets things up, forward is what happens every time the model predicts. |
My answers to the exercises
Q1. A model outputs [2, 1, 0] for three classes. Compute the softmax (three decimals) and check that it sums to 1.
e² ≈ 7.389, e¹ ≈ 2.718, e⁰ = 1, total ≈ 11.107. Softmax ≈ [0.665, 0.245, 0.090], which sums to 1.000.
Q2. Following on: if the correct class is the first, what is the cross-entropy loss? If it's the third? Which is bigger and why?
First class: −ln(0.665) ≈ 0.408. Third class: −ln(0.090) ≈ 2.408. The third is much bigger because the model gave the right answer only a 9% chance. It was confidently wrong, so it gets punished more.
Q3. User factors [0.9, 0.1, −0.5], movie factors [0.8, −0.2, −0.6]. Compute the predicted score with a dot product.
0.9 × 0.8 + 0.1 × (−0.2) + (−0.5) × (−0.6) = 0.72 − 0.02 + 0.30 = 1.00.
Q4. Why add user and movie biases? The model got worse after adding them. Why, and how was it fixed?
Some people rate everything highly and some films everyone loves; biases capture those overall tendencies. Adding them meant more parameters, so the model started memorising the training data (overfitting) and validation loss went up. Weight decay (e.g. wd=0.1) kept the weights small and fixed it.
Q5. Your GPU only fits a batch size of 32, but you want the effect of 64. How does gradient accumulation do it?
Put 32 items through the GPU and compute gradients without updating, do it again for another 32, then update once using the gradients from all 64. Memory only needs room for 32, but the update behaves like a batch of 64.
My Zettelkasten card
Card|Recommenders don't need to know who you are, only who is like you
The surprising thing about collaborative filtering is that the model never needs to know a film's genre or a user's age. Looking only at who rated what, it learns numbers that describe taste. People with similar tastes end up with similar numbers, so it can suggest what similar people liked.
I see this on YouTube. After I watched a few skateboarding clips, my home page filled with trick tutorials, board reviews and skaters I'd never heard of. YouTube doesn't know I skate; it only knows that people who watched those videos also watched these. It also worries me a bit, because recommendations can narrow what I see more and more. The data ethics lesson calls this a feedback loop, and I want to look into it.
My next step this week: count how many of my top 20 YouTube recommendations are about skating, then watch three videos on totally different topics and see how the recommendations change.
🔗 Related notes to grow next: → Tech and life: 'Algorithms read what you do, not what you say' → Ethics: 'Recommenders can trap people in a bubble' → Maths: 'A dot product measures how alike two lists of numbers are'
Back to lesson note:L07_協同過濾_202611041526