Page 1
Lecture 02 Nearest Neighbor Methods STAT 479: Machine Learning, Fall 2018 Sebastian Raschka http://stat.wisc.edu/~sraschka/teaching/stat479-fs2018/ 1
Generating preview...
Lecture 02 Nearest Neighbor Methods STAT 479: Machine Learning, Fall 2018 Sebastian Raschka http://stat.wisc.edu/~sraschka/teaching/stat479-fs2018/ 1
1-Nearest Neighbor Prediction Step closest_point := None closest_distance := for : current_distance := if current_distance < closest_distance: closest_distance := current_distance closest_point := return closest_point closest_point is the label of Sebastian Raschka STAT 479: Machine Learning FS 2018 !5
Commonly used: Euclidean Distance (L2) m 2 d(x[a],x[b]) = x[a] − x[b] ∑( j j ) j=1 Sebastian Raschka STAT 479: Machine Learning FS 2018 !6
a a Decision Boundary Between (a) and (c) d c Sebastian Raschka STAT 479: Machine Learning FS 2018 !10
Which Point is Closest? Euclid distan a c ? b Sebastian Raschka STAT 479: Machine Learning FS 2018 !13
a ? a ? b b Depends on the Distance Measure! Euclidean distance=1 Manhattan distance=1 a c ? ? b Sebastian Raschka STAT 479: Machine Learning FS 2018 !14
Continuous Distance Measures Euclidean Manhattan 1 Minkowski: m p p d(x[a],x[b]) = x[a] − x[b] [∑( ) ] j=1 Mahalanobis ... Sebastian Raschka STAT 479: Machine Learning FS 2018 !15
Discrete Distance Measures m Hamming: d(x[a],x[b]) = ∑ x[a] − x[b] j=1 Jaccard/Tanimoto Cosine similarity Dice ... Sebastian Raschka STAT 479: Machine Learning FS 2018 !16
Feature Scaling Euclidean Euclidean distance=1 distance=1 c c a ? a ? b b Euclidean Sebastian Raschka STAT 479: Machine Learning distance=1FS 2018Manhattan !17 distance=1
A y: Majority vote: Purality vote: B y: Majority vote: None Purality vote: Sebastian Raschka STAT 479: Machine Learning FS 2018 !19
kNN for Classification 𝒟 = {⟨x[1], f(x[1])⟩,…,⟨x[k], f(x[k])⟩} 𝒟k ⊆ 𝒟 k Sebastian Raschka STAT 479: Machine Learning FS 2018 !20
Showing the first 20 pages. Download the document to see it all.
No comments yet. Be the first!
Comments (0)
No comments yet. Be the first!