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.
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.
kNN is just a simple interpolation of feature space, so its visualization would be in fact equivalent to just drawing a train set in some less or more funky manner, and unless the problem is simple this would be rather harsh to decipher.
You may do this by counting the distances between train objects the way you did it in kknn, then use
cmdscale to cast this on 2D, finally plot directly or using some smoothed scatterplot using colours to show classes or values (the smoothed regression version would require probably some hacking with hue and intensity). However, as I wrote, this would be probably a totally useless plot.