September 2025
Intermediate
280 pages
7h 38m
English
In this chapter, we’ll extend our KNN implementation to perform regression. For our purposes, regression simply means predicting a numeric value. With some small additions to our code from Chapter 7, we can use our same KNN class to not only classify but also make predictions about any numeric attribute value in our datasets.
We’ll apply regression to the two KNN examples from the preceding chapter. First, we’ll revisit the fish dataset and use regression to predict the weight of a fish based on its dimensions. Then, we’ll write a program that allows the user to draw part of a digit and then predicts ...
Read now
Unlock full access