We learned how to use the k-nearest neighbors algorithm to build a classifier. The good thing is that we can also use this algorithm as a regressor. The object's output is represented by its property value, which is the average of the values of its k-nearest neighbors.
Constructing a k-nearest neighbors regressor
Getting ready
In this recipe, we will see how to use the k-nearest neighbors algorithm to build a regressor.
How to do it...
Let's take a look at how to build a k-nearest neighbors regressor:
- Create a new Python file and import the following packages...