LearnThatStack Ace your next interview
Classical ML Algorithms · question
Question 6 of 56

What is KNN, and why is it called a lazy, non-parametric learner?

beginner
← All Classical ML Algorithms questions
Re-explain

K-nearest neighbours (KNN) stores the training rows and predicts by finding the k closest ones to a new point. Classification takes the majority label among those neighbours.

It is lazy because there is no real training step. Fitting just keeps the data in memory, and all the work happens at prediction time. A naive scan costs about O(nd) distance computations per query, with n rows and d features.

It is non-parametric because no fixed set of parameters is ever learned. The shape of the decision boundary comes from the data itself, so it can bend any way the classes require. That is the appeal: you assume nothing about linearity or about the distribution of the features. The cost is that the whole dataset must be kept and searched for every single prediction.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Classical ML Algorithms cheatsheet.

← Back to all Classical ML Algorithms questions
Pro · $10/mo

48 of 56 Classical ML Algorithms answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime