Chapter 3. Classifying based on similarities with k-nearest neighbors
This chapter covers
- Understanding the bias-variance trade-off
- Underfitting vs. overfitting
- Using cross-validation to assess model performance
- Building a k-nearest neighbors classifier
- Tuning hyperparameters
This is probably the most important chapter of the entire book. In it, I’m going to show you how the k-nearest neighbors (kNN) algorithm works, and we’re going to use it to classify potential diabetes patients. In addition, I’m going to use the kNN algorithm to teach you some essential concepts in machine learning that we will rely on for the rest of the book.
By the end of this chapter, not only will you understand and be able to use the kNN algorithm to make classification ...
Get Machine Learning with R, the tidyverse, and mlr 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.