Classification and Regression with k-Nearest Neighbors

In this chapter, we will introduce k-Nearest Neighbors (KNN), a simple algorithm that can be used for classification and regression tasks. KNN's simplicity belies its power and usefulness; it is widely used in the real world in a variety of applications, including search and recommender systems. We will compare and contrast KNN with simple linear regression and work through toy problems to understand the model.

Get Mastering Machine Learning with scikit-learn - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.