Lesson map
Lesson 15. Map, example, EX061.
flowchart TD
W["Printed weights and bias"] --> E["Five eps values, no sixth"]
E --> A["Accuracy falls from 0.985 to 0.505"]
A --> R["The receipt rule stays prose"]
The step moves synthetic points. It does not edit a receipt image.
Logical drawing
weights w=(1.795, 1.756) b=-0.080
eps=0.00 accuracy=0.985
eps=0.25 accuracy=0.950
eps=0.50 accuracy=0.840
eps=0.75 accuracy=0.660
eps=1.00 accuracy=0.505
Learning outcomes
After this chapter, you should be able to:
- Read the printed weights, the bias, and the five accuracies.
- Describe the step as a signed move of size eps on a synthetic point.
- Keep the €500 review rule out of this print.
15.1 Training uses seed 7. The accuracy loop only evaluates.
random.Random(7) draws two clusters. A point labelled 1 is centred at +1 on both axes. A point labelled 0 is centred at −1. The Gaussian scale is 0.7. Four hundred points train. Two hundred points are held for the accuracy lines. Logistic regression starts at weights [0, 0] and bias 0, runs 200 epochs, and steps by 0.1 times the mean gradient. The printed result of that training is w=(1.795, 1.756) and b=-0.080.
acc does not train again. For each test point it computes p, then builds a new point by adding eps * sign((p - y) * w) on each axis. It scores the new point with the same weights and counts a success when the sigmoid output is at least 0.5 and the label agrees. At eps 0 the added term is zero, so the line is the clean accuracy 0.985. The later lines are 0.950, 0.840, 0.660 and 0.505. The tuple of eps values has five entries. A sixth eps is not printed.
The points are numbers from a generator. They are not pixels, and they are not scanned receipts. The manuscript's decision for ReceiptSort — manual review above €500 or when confidence is low — lives in the adoption prose. It is not a column of this print. Nothing in this chapter is a procedure for altering a real receipt, a real image, or a production classifier.
Lesson table; scroll horizontally to read all columns →
| eps | Printed accuracy | What it is |
|---|---|---|
| 0.00 | 0.985 | Clean test points |
| 0.50 | 0.840 | Midpoint of the five |
| 1.00 | 0.505 | Last printed line |
| any other | not printed | Not a result |
15.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Proposal for the Tallis note | Decision |
|---|---|
| Quote the five accuracies and the weights | Keep |
| Add eps 1.25 because the trend is clear | Refuse |
| Turn the sign step into steps for a receipt scan | Refuse |
| Leave the €500 review in the adoption plan, as prose | Keep |
Synthetic case. ReceiptSort's review rule and this weight vector are different objects.
Errors and limits
A falling accuracy on toy points is a lesson about this classifier. It is not evidence that a client's receipt was altered.
Apply
- EX061 — Five lines. What do the weights and the five accuracies say, and what must the note refuse to add?
Show marking criteria
Rubric: 3 = w=(1.795, 1.756), b=-0.080, accuracies 0.985 down to 0.505; no sixth eps; the €500 rule stays prose; no receipt procedure;; 2 = the five lines and the refusal;; 1 = one accuracy;; 0 = adds an eps or a procedure.