Past questions › sample-q23b
2025 3 marks Short answer Software Automation (Year 12) Linear regression v K-nearest neighbour
NESA HSC Software Engineering Sample Examination + Marking Guidelines (official, 2025)
Compare linear regression and K-nearest neighbour. (3 marks, max 75 words)
Marking 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.