MATLAB Answers

How to perform KNN regression

13 views (last 30 days)
Mekala balaji
Mekala balaji on 26 Aug 2017
Commented: Image Analyst on 26 Aug 2017
Hi,
I have data as below:
X:
1
2
3
4
9
11
13
17
19
20
y:
0.1
0.3
0.4
0.65
1.5
2.5
2.7
2.9
3.2
3.6
I want to compute y values for at x values at 6.3, 15.5&21.5
1. for each value of x, I want to take 4 nearest points in my calculation and choose most reasonable one as the final y
2. In the second method, compare minkowski & chebychev distances and choose most reasonable one
Many thanks in advance,
  2 Comments
Image Analyst
Image Analyst on 26 Aug 2017
"In the second method, compare ....." sounds like a homework problem,

Sign in to comment.

Answers (1)

Royi Avital
Royi Avital on 26 Aug 2017
At each point you want to calculate the value (x, y) find the K closest point (For x).
Then average them to create the new value.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!