问题
What is the k nearest neighbour regression function in Matlab? Is only knn classification function available? Is anybody knowing any useful literature regarding to that?
Regards
Farideh
回答1:
I don't believe the k-NN regression algorithm is directly implemented in matlab, but if you do some googling you can find some valid implementations. The algorithm is fairly simple though.
- Find the k-Nearest elements using whatever distance metric is suitable.
- Convert the inverse distance weight of each of the k elements
- Compute weighted mean of the k elements using the inverse distance weight.
来源:https://stackoverflow.com/questions/19807294/knn-regression-in-matlab