Encoding categories and unknown values
Programme names are labels, not a ranking. One-hot encoding uses one indicator position for each saved category.
Programme is nominal. Assigning CS=0, Economics=1, Psychology=2 invents order and numerical distances. One-hot encoding with fixed column order [CS,Economics,Psychology] gives [1,0,0], [0,1,0] and [0,0,1]. Low<Medium<High is ordinal, but an ordering still does not guarantee equal gaps.
The lab chooses an ignore-unknown rule: Physics becomes [0,0,0]. That means no known category match, not missing all evidence about the person. Another defensible design could predeclare an Unknown category. Never silently change the fitted vocabulary or column order when a new student arrives. Monitor unknown categories and document the chosen rule.
One-hot representation avoids an invented rank, but its contribution to distance is still a modelling choice. Two different known categories differ in two indicator positions. An all-zero unknown differs from each known category in one. Interpret this policy when assessing a distance-based rule.
Sources: W4 PDF pp. 2-42; L4 Tasks 1-7. All fixed worked values here were recalculated from the supplied examples. These toy rules are teaching devices, not deployable student-support recommendations.
The lab uses three scaled numbers followed by three programme indicators. This fixed layout tells the distance calculation what to compare.
Practice problems
Supplementary study questions on the lecture concepts — not verbatim exam questions. Each answer counts toward spaced review.
1. Conceptual understanding
Definitions and distinctions.
With category order [CS,Economics,Psychology], how is CS one-hot encoded?
Under the saved ignore-unknown policy, how is unseen Physics encoded?
2. Application
Apply the concept to a case or calculation.
With order [CS,Economics,Psychology], which vector encodes Economics?
What can go wrong with CS=1, Economics=2, Psychology=3 in a distance method?
3. Interpretation and limitations
Evaluate assumptions and justify conclusions.
The saved encoder has three categories. Under ignore-unknown, how many output positions does Physics have?
What does the CS coordinate equal for a Psychology student?
Explain it in writing
Self-checked, not marked. Write a few sentences, then compare with the example answer. Your writing is saved as you type.
Show an example answer
The model expects the same positions and width for every record. Adding a position only at prediction time breaks that contract; apply the saved unknown policy.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?
Show an example answer
It means the programme is not one of the three saved categories. It does not mean missing numeric measurements or membership in all three programmes.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?