Software Engineering › Key terms › Y12 Software Automation › K-nearest neighbour (KNN)
K-nearest neighbour (KNN)
Term Key terms bank Y12 Software Automation
Also listed as: K-nearest neighbour
Definition
Classifies a new item by looking at the K closest items in the training data and choosing the most common class among them.
Example: With K = 3, the three nearest points vote.
Found in: syllabus, sample exam and familiarisation guidelines, school notes.
Classify by the majority of the K closest points.
Where it is used in the test
Syllabus area: Y12 Software Automation.
Question types it can appear in
- Short answer: Compare with linear regression (sample Q23b)
- Multiple choice: Pick the option that matches the definition or example.
Where it has appeared in the paper
Software Automation (Part B). Part letters follow each paper’s own layout.
Related past questions
- Sample exam Q23b (3 marks): Linear regression v K-nearest neighbour Software Automation (Part B) · 3 marks
These are the questions the flashcard set links to this term. Open each one and compare your answer with its marking criteria.
Study links
- Flashcard: K-nearest neighbour (KNN) in Software Automation (Year 12) · study that set
- Memorise: Decision trees
- Key terms bank entry: K-nearest neighbour
- Master answer: sample-q23b (3 marks, short answer (compare, max 75 words)) (Master model answers: Software Automation)
- Notes: Describe types of algorithms associated with ML, including linear regression, logistic… (Software Automation (Year 12))
- Notes: Regression models and KNN (Software Automation (Year 12))
- Notes: Models of training ML (Software Automation (Year 12))
How to use it in an answer
A model sentence
“Classifies a new item by looking at the K closest items in the training data and choosing the most common class among them.” Then apply it: With K = 3, the three nearest points vote.
In a short answer, give the definition in your own words first, then tie it to the situation in the question. Do not copy the example above unless it fits the scenario.
Command words used with it
- Compare: Show how things are similar or different. (Sample exam Q23b (3 marks): Linear regression v K-nearest neighbour)
Technique for the question types
- Short answer: One clear point per mark, use the stimulus and course terms, and answer the command word.
- Multiple choice: Read all four options, rule out wrong ones, pick one; no penalty for guessing so never leave blank.
What the marking guidelines and feedback say
Some school notes list KNN as unsupervised: that is wrong. NESA's sample answer treats KNN as supervised.
Worked answers from the marking guidelines
Sample exam Q23b (3 marks): Linear regression v K-nearest neighbour (3 marks): criteria and sample answer
Criteria
3: Compares linear regression and KNN. 2: Outlines features of one or both. 1: Some relevant information.
Sample answer
Linear regression and K-nearest neighbours (KNN) are both supervised learning algorithms that make predictions from labelled data. The key difference is how they handle data: linear regression assumes a linear relationship between input features and the target variable, while KNN makes predictions based on the closest 'K' training examples, allowing it to handle more complex, non-linear patterns. However, KNN can be more computationally expensive than linear regression and is usually slower.
Common mistakes
- Use the term exactly as the syllabus words it, then link it to the scenario in the question; the 2025 feedback repeatedly rewards using the stimulus.
- Answer the command word: outline gives main points only, explain gives a reason or cause, discuss gives both sides.
Related terms
Same group in the syllabus: Decision tree · Neural network · Linear regression · Polynomial regression · Logistic regression · OOP for ML programming · Neural network code (predict)