November 2016
Beginner to intermediate
959 pages
43h 46m
English
The FNN package provides the necessary functions to apply the KNN technique for regression. In this recipe, we look at the use of the knn.reg function to build the model and then the process of predicting with the model as well. We also show some additional convenience mechanisms to make the process easier.
Install the FNN, dummies, caret, and scales packages if you do not already have them installed. If you have not already downloaded the data files for this chapter, do so now and ensure that the education.csv file is in R working directory. The file has data about several school districts in the US. The following table describes the variables:
|
Variable |
Meaning |
|---|---|
|
|
US state code |
|
|
Read now
Unlock full access