Lesson 15
Model Monitoring
Nine beginner steps on one live line: week 1 still hits 70, week 2 hours jump to 14, and week 3 the same 5 hours scores 50.
What You Will Learn
Nine steps. The line has already shipped. Three later students tell you whether to leave it alone, watch a new hour, or retrain.
- 1. What is model monitoring?
- 2. Two bells on this class
- 3. Where each bell shows up
- 4. Where it sits after the workflow
- 5. What a perfect week hides
- 6. How the three weeks separate
- 7. Key Takeaways
- 8. Mind Map
- 9. Quiz
1. What is model monitoring?
Model monitoring is the habit of comparing new students with the line you already froze.
The line is marks = 20 + 10 × hours. It was built on A, B and D, and it was checked on C: 8 hours, guess 100, actual 100. That check is the ML workflow. This page starts the Monday after it.
Three new students sit the paper later. You do not refit the line while you read them.
| Week | Student | Hours | Line says | Actual mark | Actual minus line |
|---|---|---|---|---|---|
| 1 | E | 5 | 70 | 70 | 0 |
| 2 | F | 14 | 160 | 160 | 0 |
| 3 | G | 5 | 70 | 50 | −20 |
The training hours were 1, 2 and 9. Their mean is (1 + 2 + 9) / 3 = 4. The last hour the line was built on is 9.
The picture above is the whole decision. E sits on the old line. F sits on it too, far to the right of the grey training dots. G has the same 5 hours as E and lands on 50.
2. Two bells on this class
Two changes can happen, and they ring on different columns.
| Bell | What moved | Who rings it here |
|---|---|---|
| Data drift | The hours. The rule can still be true | F, at 14 hours. The miss is still 0 |
| Concept drift | The rule. The hours can look familiar | G, at 5 hours. The mark fell from 70 to 50 |
Week 1 rings neither bell. E studied 5 hours, one hour from the training mean of 4, and the line hits 70.
Week 2 rings the hour bell. 14 is five hours past the last training hour, 9. The line still hits, 20 + 10 × 14 = 160, so the mark bell stays quiet.
Week 3 rings the mark bell. G studied the same 5 hours as E. The line still says 70. The paper comes back as 50. The +20 has left the exam. The new rule on this paper is marks = 10 × hours, because 10 × 5 = 50.
3. Where each bell shows up
| What arrived today | What you do |
|---|---|
| Hours near 4, and the mark matches the line | Leave the line in place. That is week 1 |
| An hour past 9, before the paper is graded | Write "new region" next to the hour. You can see this with no mark at all |
| An hour past 9, and the mark still matches | Keep the line. One agreeing row is not a new line. Keep collecting that region. That is week 2 |
| Familiar hours, and the mark is 20 below the line | The relationship changed. Retrain on the new paper, and hold one new student out. That is week 3 |
| A pass or fail stored from the guess alone | The guess for 5 hours is 70, a pass if 60 is the cut. G actually scored 50, a fail. Store the guess and the mark as two columns |
A later score called a population stability index compares a large pile of new hours with the training pile. These three students are small enough that the mean and the edge already show it: mean 4, edge 9, new hour 14.
4. Where it sits after the workflow
The order is fixed.
- Freeze the line in the workflow. Here that line is marks = 20 + 10 × hours, checked on C.
- Each new week, read the hours before you read the mark.
- When the mark arrives, subtract the line from it.
- Retrain only when that subtraction says the rule changed.
- A retrain is a new workflow: name the column again on the model selection page, and hold one new student out.
A learning curve asks whether more rows of the same rule will help. More copies of A, B and D still say 70 for 5 hours. Week 3 is a different paper, so those extra copies do not repair G.
5. What a perfect week hides
Week 2 has a miss of 0. A board that only prints the miss stays green. The hour 14 is the alarm, and it was visible on the morning F sat down, before anyone graded the paper.
The distance from the training mean is 14 − 4 = 10. Week 1 and week 3 are 5 − 4 = 1. The hour bell uses that distance. It does not use the mark.
Log the guess on the day of the exam and the mark on the day the paper returns. For G you write 70 on Monday and 50 when the paper is graded. The −20 appears at grading time. A notebook that waits for the mark and then throws the guess away cannot show you the gap.
6. How the three weeks separate
Read the three rows in order.
Week 1. 20 + 10 × 5 = 70. E scored 70. The miss is 0. The hour 5 sits inside 1 to 9. Leave the line alone.
Week 2. 20 + 10 × 14 = 160. F scored 160. The miss is 0, and the hour is new. You write the new region down and you keep the line. One student who still agrees is not a reason to draw a second line.
Week 3. The line still says 70, because the hours are 5 again. G scored 50. 50 − 70 = −20. The hours look like week 1, so the hour bell is quiet. The mark bell is the one that rings. This is the week you retrain.
This page needs one module: pandas. It holds the three weeks and subtracts. NumPy is not required. scikit-learn is not required.
| Piece | What it means here |
|---|---|
import |
Load a module into this notebook |
pandas |
The table module |
as pd |
The short name. Later lines say pd |
pd.DataFrame |
Build the three weeks |
weeks["line"] |
A new column: 20 + 10 × hours |
weeks["miss"] |
Actual mark minus that line |
import pandas as pd
weeks = pd.DataFrame({
"week": ["week 1", "week 2", "week 3"],
"hours": [5, 14, 5],
"actual": [70, 160, 50],
})
weeks["line"] = 20 + 10 * weeks["hours"]
weeks["miss"] = weeks["actual"] - weeks["line"]
print(weeks)
print("training hours mean:", (1 + 2 + 9) / 3)import pandas as pd is the whole requirements line. The line column is arithmetic on hours, which you knew on exam day. The miss column waits for the actual mark. Building a column this way is the same idea as the pandas column lesson.
The printed table:
| Week | Hours | Actual | Line | Miss |
|---|---|---|---|---|
| week 1 | 5 | 70 | 70 | 0 |
| week 2 | 14 | 160 | 160 | 0 |
| week 3 | 5 | 50 | 70 | −20 |
The last line prints 4.0, the mean of the training hours 1, 2 and 9.
7. Key Takeaways
- Monitoring compares each new student with a line you already froze: marks = 20 + 10 × hours.
- The hour bell uses the training hours 1, 2 and 9, mean 4, edge 9.
- Week 1: 5 hours, mark 70, miss 0. Leave the line alone.
- Week 2: 14 hours, mark 160, miss 0. The input moved. The rule still holds, so you log the new region and keep the line.
- Week 3: the same 5 hours, mark 50, miss −20. The rule changed. Retrain.
- The only module required here is pandas, loaded with
import pandas as pd. - The playground prints the three misses 0, 0, −20 and the training mean 4.0.
8. Mind Map
Cover the pink dot. If 5 hours still means 70, and 14 hours is the only stranger, the line stays. When that same 5 hours comes back as 50, the line is finished.
9. Quiz
The questions use these three weeks. E at 5 hours scores 70. F at 14 hours scores 160. G at 5 hours scores 50. The frozen line is marks = 20 + 10 × hours.
Loading playground…
Check your understanding
Model Monitoring Quiz
Week 1: E studied 5 hours. The frozen line says 70, and E scored 70. What do you do?
1 / 6