Skip to Content
Machine Learning Foundations, Volume 1: Supervised Learning
book

Machine Learning Foundations, Volume 1: Supervised Learning

by Roi Yehoshua
September 2025
Intermediate to advanced content levelIntermediate to advanced
812 pages
23h 14m
English
Addison-Wesley Professional
Content preview from Machine Learning Foundations, Volume 1: Supervised Learning

Chapter 6. K-Nearest Neighbors

The k-nearest neighbors algorithm (KNN) is a simple yet powerful machine learning technique. It classifies a new instance by assigning it the most frequent label among its k closest neighbors in the training set. Unlike many learning algorithms that build a model during the training phase, KNN is a lazy learner that defers most of the computation until prediction time. In addition, it is a non-parametric and instance-based algorithm, meaning it makes no assumptions about the underlying data distribution and relies directly on the stored training instances for predictions.

KNN is highly adaptable to various datasets. By leveraging local neighborhoods of data points for prediction, it can form decision boundaries ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook, 2nd Edition

Machine Learning with Python Cookbook, 2nd Edition

Kyle Gallatin, Chris Albon
Python Machine Learning - Third Edition

Python Machine Learning - Third Edition

Sebastian Raschka, Vahid Mirjalili

Publisher Resources

ISBN: 9780135337851