Using R plot()
and plotcp()
methods, we can visualize linear regression model (lm
) as an equation and decision tree model (rpart
) as a tree. We can develop k-nearest neighbour model using R kknn()
method, but I don't know how to present this model. Please suggest me some R methods that produce nice graphs for knn model visualization.
Solved – Visualizing k-nearest neighbour
data visualizationk nearest neighbourr
Best Answer
If you want to visualize KNN classification, there's a good example here taken from the book An Introduction to Statistical Learning, which can be downloaded freely from their webpage.
They also have several neat examples for KNN regression, but I have not found the code for those.
More to the point, the package you mentioned,
kknn
, has built-in functionality for plot() for many of its functions, and you should browse the vignette, which contains several examples.