K Nearest Neighbours — Step By Step Explanation In 5 Minutes

Liu Zuo Lin
5 min readApr 16, 2022

Let’s say we want to perform a classification task using the K Nearest Neighbours (KNN) algorithm — to predict whether a student is part of the math Olympiad (1 if inside, 0 if not) based on 1) math score and 2) science score. To perform classification, we need:

  • A test dataset — the students we aim to predict for
  • A train dataset — we…

--

--