Professional Documents
Culture Documents
03d Algind KNN Eng
03d Algind KNN Eng
Javier Bejar c b e a
LSI - FIB
Term 2012/2013
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
1 / 23
Outline
K-nearest neighbours
K-nn Algorithm
K-nn Regression
Advantages and drawbacks
Application
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
2 / 23
K-nearest neighbours
K-nn Algorithm
K-nn Regression
Advantages and drawbacks
Application
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
3 / 23
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
4 / 23
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
5 / 23
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
6 / 23
K-nearest neighbours
K-nearest neighbours
K-nn Algorithm
K-nn Regression
Advantages and drawbacks
Application
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
7 / 23
K-nearest neighbours
K-nearest neighbours
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
8 / 23
K-nearest neighbours
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
9 / 23
K-nearest neighbours
K-nn Algorithm
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
10 / 23
K-nearest neighbours
K-nn Algorithm
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
11 / 23
K-nearest neighbours
K-nn Algorithm
K-nearest neighbours
Term 2012/2013
12 / 23
K-nearest neighbours
K-nn Algorithm
There are different possibilities for computing the class from the k
nearest neighbours
Majority vote
Distance weighted vote
Inverse of the distance
Inverse of the square of the distance
Kernel functions (gaussian kernel, tricube kernel, ...)
Once we use weights for the prediction we can relax the constraint of
using only k neighbours
1
2
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
13 / 23
K-nearest neighbours
K-nn Regression
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
14 / 23
K-nearest neighbours
K-nn Regression
Simple interpolation
Javier B
ejar c b ea (LSI - FIB)
K-nn averaging
K-nearest neighbours
Term 2012/2013
15 / 23
K-nearest neighbours
K-nn Regression
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
16 / 23
K-nearest neighbours
K-nn Regression
0.5
0
-4
-2
K-nearest neighbours
Term 2012/2013
17 / 23
K-nearest neighbours
K-nn Regression
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
18 / 23
K-nearest neighbours
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
19 / 23
K-nearest neighbours
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
20 / 23
K-nearest neighbours
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
21 / 23
K-nearest neighbours
Application
A A
A A A
A A A
A A A
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
22 / 23
K-nearest neighbours
Application
Javier B
ejar c b ea (LSI - FIB)
K-nearest neighbours
Term 2012/2013
23 / 23