Knn regression in Matlab

2019-06-24 15:45发布

问题:

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.

  1. Find the k-Nearest elements using whatever distance metric is suitable.
  2. Convert the inverse distance weight of each of the k elements
  3. Compute weighted mean of the k elements using the inverse distance weight.