Software Engineering › Learn step by step › Y12 Software Automation
Item 313 of 426 · Year 12: Software Automation, 20 of 35
K-nearest neighbour (KNN)
Term Key terms bank
Jump to a topic
- Exam format, question types and command words (46)
- Year 11: Programming Fundamentals (69)
- Year 11: The Object-Oriented Paradigm (33)
- Year 11: Programming Mechatronics (29)
- Year 12: Secure Software Architecture (57)
- Year 12: Programming for the Web (59)
- Year 12: Software Automation (35)
- Year 12: The Software Engineering Project (47)
- Diagrams and modelling tools (18)
- Python, SQL, pseudocode and CSS patterns (33)
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 you'll use it 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
How to use it
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)
Official worked answer
Sample exam Q23b (3 marks): Linear regression v K-nearest neighbour (3 marks): official 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.
Go deeper
- 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))
- Full term page: every question, note and marking comment for K-nearest neighbour (KNN)
Check yourself
Explain “K-nearest neighbour (KNN)” in one sentence, give an example, and name a question type that could test it.
Reveal the answer
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.
Could be tested as: Short answer, Multiple choice.
Quick multiple choice
K-nearest neighbour (KNN) classifies a new item by:
- Looking at the labels of the K closest examples in the training data
- Randomly choosing a label
- Drawing a straight line through all the data
- Removing all labelled data
Show the answer
A
KNN is a supervised algorithm: the majority label of the K nearest neighbours is used. It is not a clustering algorithm (school notes say 'clustering such as KNN' which is incorrect).
Source: original (written for this study pack; not a NESA question). Open it in the multiple-choice bank.