internalsGet Pro

Module 07 · Lesson 3 of 12Pro

k-nearest neighbours: learning from similar examples

Level
Beginner
Topic
Classical ML: regression and classification
Reading time
14 min

When you finish this page you can

  1. Predict a customer’s chance of leaving by hand from the labels of their k nearest neighbours.
  2. Choose k on validation data, and explain why k = 1 and a very large k both give a poor list.
  3. Explain why k-NN needs scaled features and few useful features, and what happens with many.
  4. Estimate k-NN’s prediction cost and memory, and say when it beats logistic regression.
  1. Norms and distances between data points14 min
  2. Bias and variance: two kinds of error16 min
  3. Cross-validation: getting more from little data17 min
  4. Logistic regression: predicting probabilities13 min

The closest customer says 0, the model says 0.33

is our example online store. Every Monday, Joseph’s growth team sends ₹100 vouchers to the 20,000 customers most likely to : to stop buying. Farah, an ML engineer, builds the model that ranks them, on a notebook sample of 200,000 customers.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan