won't you be my nearest neighbor

Download Won't You be my Nearest Neighbor

If you can't read please download the document

Upload: woody-schneider

Post on 15-Jun-2015

709 views

Category:

Technology


2 download

DESCRIPTION

I breif outline of nearest neighbor and implementing it in MATLAB

TRANSCRIPT

  • 1. Nearest Neighbor An Explanation of Nearest Neighbor and how to use it to get to know your data inMatlab

2. Match Making for Soda Lovers 3. 4. Sweetness 5. Sweetness Carbonation 6. Sweetness Carbonation Price 7. Sweetness Carbonation Price Acidity 8. Sweetness Carbonation Price Acidity Caffeination 9. Sweetness Carbonation Price Acidity Caffeination Etc. 10. Sweetness Carbonation Price Acidity Caffeination Etc. Etc. 11. Sweetness Carbonation Price Acidity Caffeination Etc. Etc. Etc. 12. Soda ID Sweetness Carbonation Price Soda 1 3.5 4.3 $1.00 Soda 2 5.1 4.1 $1.50 Soda 3 4.2 2.2 $2.00 Soda 4 3.1 4.2 $0.75 Soda 5 6 3.0 $0.50 Sweetness Carbonation Price 13. xlsread(filename) csvread(filename) Sweetness Carbonation Price 3.5 4.3 $1.00 5.1 4.1 $1.50 4.2 2.2 $2.00 3.1 4.2 $0.75 6 3.0 $0.50 Soda Brand Soda 1 Soda 2 Soda 3 Soda 4 Soda 5 [SODAS, BRANDS] = xlsread(filename) Sweetness Carbonation Price 14. 15. 16. 17. 18. * 19. * * * * * * * * * * * * 20. * * * * * * * * * * * * 21. * * * * * * * * * * * * 22. * * * * * * * * * * * * 23. The Basic Math Difference in Sweetness Difference in Carbonation Difference in Price Sweetness Carbonation a b A^2 + b^2 = c^3 Distance: (in lots of dimensions) 24. Matlab dsearchn N-Dimensional nearest point search Syntax k = dsearchn(SODAS,IDEALS) rangesearch Find all neighbors specified distance using KDTreeSearcher object Syntax [idx,D]= rangesearch(SODATREE,IDEALS,r) 25. Matlab dsearchn N-Dimensional nearest point search Syntax k = dsearchn(SODAS,IDEALS) knnsearch Find k-nearest neighbors using data Syntax [IDX,D] = knnsearch(SODATREE,IDEALS,r) For single nearest point For More Neighbors (requires a tree) 26. Easy One Match Search dsearchn N-Dimensional nearest point search Syntax I = dsearchn(SODAS,IDEALS) 27. Harder Multi Match Search Building a Tree Sweetness Carbonation Price 3.5 4.3 $1.00 5.1 4.1 $1.50 4.2 2.2 $2.00 3.1 4.2 $0.75 6 3.0 $0.50 SODATREE = kdtreesearcher(SODAS,'distance') All the Sodas 28. Sweetness Carbonation Price 3.5 4.3 $1.00 5.1 4.1 $1.50 4.2 2.2 $2.00 rangesearch Find all neighbors specified distance using KDTreeSearcher object Syntax [I,D]= rangesearch(SODATREE,IDEALS,r) * * r Harder Multi Match Search Getting neighbors Ideal Sodas 29.