SlideShare a Scribd company logo
1 of 29
Nearest Neighbor An Explanation of Nearest Neighbor and how to use it to get to know your data in  Matlab
Match Making for Soda Lovers
 
Sweetness
Sweetness Carbonation
Sweetness Carbonation Price
Sweetness Carbonation Price Acidity
Sweetness Carbonation Price Acidity Caffeination
Sweetness Carbonation Price Acidity Caffeination Etc.
Sweetness Carbonation Price Acidity Caffeination Etc. Etc.
Sweetness Carbonation Price Acidity Caffeination Etc. Etc. Etc.
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
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
 
 
 
 
*
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
* * * * * * * * * * * *
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)
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)
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)
Easy One Match Search dsearchn N-Dimensional nearest point search Syntax I = dsearchn(SODAS,IDEALS)
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
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
 

More Related Content

Viewers also liked

key to improving core competitive capacity 4 enterprise
key to improving core competitive capacity 4 enterprisekey to improving core competitive capacity 4 enterprise
key to improving core competitive capacity 4 enterprise
Trung Ngoc
 
Unit 9 photography techniques iuuo
Unit 9   photography techniques iuuoUnit 9   photography techniques iuuo
Unit 9 photography techniques iuuo
liamwhitemtb
 
Kessan 1708682945115077
Kessan 1708682945115077Kessan 1708682945115077
Kessan 1708682945115077
yoshikawa0521
 
Web Security Programming I I
Web  Security  Programming  I IWeb  Security  Programming  I I
Web Security Programming I I
Pavu Jas
 

Viewers also liked (14)

The Beauty Of The Sea
The Beauty Of The SeaThe Beauty Of The Sea
The Beauty Of The Sea
 
Jalan terindah
Jalan terindahJalan terindah
Jalan terindah
 
International CES 2012 番外編
International CES 2012 番外編International CES 2012 番外編
International CES 2012 番外編
 
Ppt32
Ppt32Ppt32
Ppt32
 
key to improving core competitive capacity 4 enterprise
key to improving core competitive capacity 4 enterprisekey to improving core competitive capacity 4 enterprise
key to improving core competitive capacity 4 enterprise
 
Unit 9 photography techniques iuuo
Unit 9   photography techniques iuuoUnit 9   photography techniques iuuo
Unit 9 photography techniques iuuo
 
Does simultaneous outsourcing of all your purchase-to-pay processes and achie...
Does simultaneous outsourcing of all your purchase-to-pay processes and achie...Does simultaneous outsourcing of all your purchase-to-pay processes and achie...
Does simultaneous outsourcing of all your purchase-to-pay processes and achie...
 
Kessan 1708682945115077
Kessan 1708682945115077Kessan 1708682945115077
Kessan 1708682945115077
 
Casă din Haran grafică 3 D [ obedeya d.d.a.ben aharon cohen]
Casă din Haran grafică 3 D [ obedeya d.d.a.ben aharon cohen]Casă din Haran grafică 3 D [ obedeya d.d.a.ben aharon cohen]
Casă din Haran grafică 3 D [ obedeya d.d.a.ben aharon cohen]
 
Immigration, Women, and Children: Part II – Sample Situations
Immigration, Women, and Children: Part II – Sample Situations Immigration, Women, and Children: Part II – Sample Situations
Immigration, Women, and Children: Part II – Sample Situations
 
Tsunami dari bnpb
Tsunami dari bnpbTsunami dari bnpb
Tsunami dari bnpb
 
Quantum Entanglement - Cryptography and Communication
Quantum Entanglement - Cryptography and CommunicationQuantum Entanglement - Cryptography and Communication
Quantum Entanglement - Cryptography and Communication
 
Student Facilitator Presentation
Student Facilitator PresentationStudent Facilitator Presentation
Student Facilitator Presentation
 
Web Security Programming I I
Web  Security  Programming  I IWeb  Security  Programming  I I
Web Security Programming I I
 

Recently uploaded

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 

Recently uploaded (20)

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 

Won't You be my Nearest Neighbor