SlideShare a Scribd company logo
1 of 23
K-Nearest neighbour algorithm
Machine learning
Slides Fill with
• What is meant by algorithm
• Algorithm in Machine learning
• Category of NN algorithm
• Nearest neighbour
• How its work?
• Pseudo code
• Code-Explanation
• Example
• Positive and negative
What is meant by algorithm
COMPUTER
INPUT OUTPUT
PROBLEM
ALGORITHM
ALGORITHM
• It is a step-by-step procedure to solve a
problem
• Algorithm provides an overview for
solving and implementing problem
• These algorithm decides the solution of
the problem by implementing in
procedural way
ALGORITHM IN MACHINE LEARNING
ALGORITHM IN MACHINE LEARNING
• IN the machine learning algorithm is
categorized based on types of machine
learning
• Types of machine learning are
Supervised machine learning
Unsupervised machine learning
Reinforcement machine learning.
A computer is learn from past experience to do some task
and measure performance then predict future.
Many machine learning tasks can be solved &
implemented by using some Algorithms.
Category of K-NN algorithm
Nearest neighbour is the kind of
supervised learning
These follow the instance based learning
approach
INSTANCE BASED LEARNING
 The instance based stored presented training data in the
memory ,when new instance is arrived a set of related instance
is retrieved from memory and classified for new instance.
 Instance based is used for more complex and symbolic data.
Nearest neighbour
 Nearest neighbour is conceptually
straightforward approaches to
approximating real-valued or discrete-
valued target functions.
 Instances are represented in this
fashion and the process for identifying
"neighbour ing" instances is elaborated
accordingly
How its work
1. Determine parameter value K
2. Calculate the distance between the
query instance and training data
3. Sort the distance
4. Determine the nearest neighbour based
kth distance.
5. Gather the category of the nearest
instances according to k value
6. Predict the result by using simple
majority instances
Nearest neighbour
The nearest
neighbours of an
instance are
defined in terms of
the standard
Euclidean distance
Pseudo code
Training and
classification
algorithm
Code explanation
• Training algorithm:
f-Data
f(x)-instance or pattern Example data
• Classification algorithm:
xq -query instance
xl . . .xk -k instances which nearest to xq.
The value should return if the given value is correct.
Code explanation
Here we have to compare
each instance with new
instance which is nearest
instance
V-distance between new
instance and training data
argmax-Average max
distance between new and
comparing training data
i=1-initial value
K-k instances
 v belongs to V-each data is
belongs to V
Code explanation
Here ,
If and b are comparing
means it a and b is equals
then pattern matches with
training and new instances
and returns 1.
Otherwise 0 and not
matching
Example
ACID DURABILITY STRENGHT CLASSIFICATION
7 7 Bad
7 4 Good
3 4 Good
1 4 Good
3 7 ?
To find: Guess the classification of the new
instance with x=3
Example
• Given:
Step 1: Find the K=3
Step 2:Calculate the each instance
distance with new instance
(7-3)2+(7-7)2 = 4
(7-3)2+(7-4)2= 5
Example
Example
(3-3)2+(7-4)2= 3
(1-3)2+(7-7)2=
13
(3-3)2+(7-7)2= 0
Example
• Step 3:Sort the calculated distance in
ascending order
The order is
1. 5
2. 4
3. 3
4. 0
5. 13
Example
• Step4:Pick neighbour ones with k=3 so,
take first three instance 5,4 and 3
• Step 5 :find the category of the instances
5-Good
4-Bad
3-Good
• Step6:Choose majority value as a result
• The result of new instance is Good
Positive of nearest neighbour
 Simple to implement
 Easy to understand
 simple Algorithm
 K-NN classification is best for local
information
 The result can be able to classify easily
Negative of nearest neighbour
 These cause over-fitting
 Robust is noisy
 Classify the new instance cost is high
 Training data should be provided for
classification
Thankyou

More Related Content

What's hot

Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDLAbd17m
 
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...WithTheBest
 
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised LearningAaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised LearningAminaRepo
 
Silicon valleycodecamp2013
Silicon valleycodecamp2013Silicon valleycodecamp2013
Silicon valleycodecamp2013Sanjeev Mishra
 
Linear Regression Ex
Linear Regression ExLinear Regression Ex
Linear Regression Exmailund
 
Linear Probability Models and Big Data: Kosher or Not?
Linear Probability Models and Big Data: Kosher or Not?Linear Probability Models and Big Data: Kosher or Not?
Linear Probability Models and Big Data: Kosher or Not?Galit Shmueli
 
Kmeans initialization
Kmeans initializationKmeans initialization
Kmeans initializationdjempol
 
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво....NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...NETFest
 
Integer sequence
Integer sequenceInteger sequence
Integer sequenceINA SINGHAL
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine LearningAmrinder Arora
 
microC-DAQ
microC-DAQmicroC-DAQ
microC-DAQKJ Lau
 
GA.-.Presentation
GA.-.PresentationGA.-.Presentation
GA.-.Presentationoldmanpat
 
ラビットチャレンジ 機械学習レポート
ラビットチャレンジ 機械学習レポートラビットチャレンジ 機械学習レポート
ラビットチャレンジ 機械学習レポートKazuyukiMasada
 
Robust real time object detection
Robust real time object detectionRobust real time object detection
Robust real time object detectionErliyah Jannah
 
Visualizing the Model Selection Process
Visualizing the Model Selection ProcessVisualizing the Model Selection Process
Visualizing the Model Selection ProcessBenjamin Bengfort
 
Machine Learning in q/kdb+ - Teaching KDB to Read Japanese
Machine Learning in q/kdb+ - Teaching KDB to Read JapaneseMachine Learning in q/kdb+ - Teaching KDB to Read Japanese
Machine Learning in q/kdb+ - Teaching KDB to Read JapaneseMark Lefevre, CQF
 

What's hot (20)

Model simulation VHDL
Model simulation VHDLModel simulation VHDL
Model simulation VHDL
 
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
 
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised LearningAaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
 
Silicon valleycodecamp2013
Silicon valleycodecamp2013Silicon valleycodecamp2013
Silicon valleycodecamp2013
 
Linear Regression Ex
Linear Regression ExLinear Regression Ex
Linear Regression Ex
 
Linear Probability Models and Big Data: Kosher or Not?
Linear Probability Models and Big Data: Kosher or Not?Linear Probability Models and Big Data: Kosher or Not?
Linear Probability Models and Big Data: Kosher or Not?
 
Kmeans initialization
Kmeans initializationKmeans initialization
Kmeans initialization
 
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво....NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...
.NET Fest 2017. Игорь Кочетов. Классификация результатов тестирования произво...
 
Integer sequence
Integer sequenceInteger sequence
Integer sequence
 
ML_in_QM_JC_02-10-18
ML_in_QM_JC_02-10-18ML_in_QM_JC_02-10-18
ML_in_QM_JC_02-10-18
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine Learning
 
microC-DAQ
microC-DAQmicroC-DAQ
microC-DAQ
 
OOP in java
OOP in javaOOP in java
OOP in java
 
Machine learning
Machine learningMachine learning
Machine learning
 
GA.-.Presentation
GA.-.PresentationGA.-.Presentation
GA.-.Presentation
 
ラビットチャレンジ 機械学習レポート
ラビットチャレンジ 機械学習レポートラビットチャレンジ 機械学習レポート
ラビットチャレンジ 機械学習レポート
 
Robust real time object detection
Robust real time object detectionRobust real time object detection
Robust real time object detection
 
Visualizing the Model Selection Process
Visualizing the Model Selection ProcessVisualizing the Model Selection Process
Visualizing the Model Selection Process
 
Introduction to FreeMat
Introduction to FreeMatIntroduction to FreeMat
Introduction to FreeMat
 
Machine Learning in q/kdb+ - Teaching KDB to Read Japanese
Machine Learning in q/kdb+ - Teaching KDB to Read JapaneseMachine Learning in q/kdb+ - Teaching KDB to Read Japanese
Machine Learning in q/kdb+ - Teaching KDB to Read Japanese
 

Similar to Nearest neighbour algorithm

EssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfEssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfAnkita Tiwari
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learningAmAn Singh
 
Adversarial Learning_Rupam Bhattacharya
Adversarial Learning_Rupam BhattacharyaAdversarial Learning_Rupam Bhattacharya
Adversarial Learning_Rupam BhattacharyaRupam Bhattacharya
 
Coursera 1week
Coursera  1weekCoursera  1week
Coursera 1weekcsl9496
 
Keynote at IWLS 2017
Keynote at IWLS 2017Keynote at IWLS 2017
Keynote at IWLS 2017Manish Pandey
 
Reinforcement Learning and Artificial Neural Nets
Reinforcement Learning and Artificial Neural NetsReinforcement Learning and Artificial Neural Nets
Reinforcement Learning and Artificial Neural NetsPierre de Lacaze
 
Grid search.pptx
Grid search.pptxGrid search.pptx
Grid search.pptxAbithaSam
 
AI -learning and machine learning.pptx
AI  -learning and machine learning.pptxAI  -learning and machine learning.pptx
AI -learning and machine learning.pptxGaytriDhingra1
 
Escaping the Black Box
Escaping the Black BoxEscaping the Black Box
Escaping the Black BoxRebecca Bilbro
 
part3Module 3 ppt_with classification.pptx
part3Module 3 ppt_with classification.pptxpart3Module 3 ppt_with classification.pptx
part3Module 3 ppt_with classification.pptxVaishaliBagewadikar
 
K-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierK-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierNeha Kulkarni
 
Data Science and Machine Learning with Tensorflow
 Data Science and Machine Learning with Tensorflow Data Science and Machine Learning with Tensorflow
Data Science and Machine Learning with TensorflowShubham Sharma
 
Instance based learning
Instance based learningInstance based learning
Instance based learningSlideshare
 
Machine learning Module-2, 6th Semester Elective
Machine learning Module-2, 6th Semester ElectiveMachine learning Module-2, 6th Semester Elective
Machine learning Module-2, 6th Semester ElectiveMayuraD1
 
Two strategies for large-scale multi-label classification on the YouTube-8M d...
Two strategies for large-scale multi-label classification on the YouTube-8M d...Two strategies for large-scale multi-label classification on the YouTube-8M d...
Two strategies for large-scale multi-label classification on the YouTube-8M d...Dalei Li
 

Similar to Nearest neighbour algorithm (20)

Machine learning
Machine learningMachine learning
Machine learning
 
EssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfEssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdf
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
 
Adversarial Learning_Rupam Bhattacharya
Adversarial Learning_Rupam BhattacharyaAdversarial Learning_Rupam Bhattacharya
Adversarial Learning_Rupam Bhattacharya
 
Coursera 1week
Coursera  1weekCoursera  1week
Coursera 1week
 
Keynote at IWLS 2017
Keynote at IWLS 2017Keynote at IWLS 2017
Keynote at IWLS 2017
 
Reinforcement Learning and Artificial Neural Nets
Reinforcement Learning and Artificial Neural NetsReinforcement Learning and Artificial Neural Nets
Reinforcement Learning and Artificial Neural Nets
 
Grid search.pptx
Grid search.pptxGrid search.pptx
Grid search.pptx
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Machine Learning
Machine Learning Machine Learning
Machine Learning
 
AI -learning and machine learning.pptx
AI  -learning and machine learning.pptxAI  -learning and machine learning.pptx
AI -learning and machine learning.pptx
 
Neural networks
Neural networksNeural networks
Neural networks
 
Escaping the Black Box
Escaping the Black BoxEscaping the Black Box
Escaping the Black Box
 
part3Module 3 ppt_with classification.pptx
part3Module 3 ppt_with classification.pptxpart3Module 3 ppt_with classification.pptx
part3Module 3 ppt_with classification.pptx
 
K-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierK-Nearest Neighbor Classifier
K-Nearest Neighbor Classifier
 
Data Science and Machine Learning with Tensorflow
 Data Science and Machine Learning with Tensorflow Data Science and Machine Learning with Tensorflow
Data Science and Machine Learning with Tensorflow
 
Instance based learning
Instance based learningInstance based learning
Instance based learning
 
Moviereview prjct
Moviereview prjctMoviereview prjct
Moviereview prjct
 
Machine learning Module-2, 6th Semester Elective
Machine learning Module-2, 6th Semester ElectiveMachine learning Module-2, 6th Semester Elective
Machine learning Module-2, 6th Semester Elective
 
Two strategies for large-scale multi-label classification on the YouTube-8M d...
Two strategies for large-scale multi-label classification on the YouTube-8M d...Two strategies for large-scale multi-label classification on the YouTube-8M d...
Two strategies for large-scale multi-label classification on the YouTube-8M d...
 

More from Anmitas1

Indroduction to machine learning
Indroduction to machine  learningIndroduction to machine  learning
Indroduction to machine learningAnmitas1
 
Are women better entrepreneur
Are women better entrepreneurAre women better entrepreneur
Are women better entrepreneurAnmitas1
 
Indroduction to machine learning
Indroduction to machine  learningIndroduction to machine  learning
Indroduction to machine learningAnmitas1
 
Cloud last
Cloud lastCloud last
Cloud lastAnmitas1
 
Presentation
PresentationPresentation
PresentationAnmitas1
 
Presentation1
Presentation1Presentation1
Presentation1Anmitas1
 

More from Anmitas1 (7)

Stories
StoriesStories
Stories
 
Indroduction to machine learning
Indroduction to machine  learningIndroduction to machine  learning
Indroduction to machine learning
 
Are women better entrepreneur
Are women better entrepreneurAre women better entrepreneur
Are women better entrepreneur
 
Indroduction to machine learning
Indroduction to machine  learningIndroduction to machine  learning
Indroduction to machine learning
 
Cloud last
Cloud lastCloud last
Cloud last
 
Presentation
PresentationPresentation
Presentation
 
Presentation1
Presentation1Presentation1
Presentation1
 

Recently uploaded

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 

Recently uploaded (20)

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

Nearest neighbour algorithm

  • 2. Slides Fill with • What is meant by algorithm • Algorithm in Machine learning • Category of NN algorithm • Nearest neighbour • How its work? • Pseudo code • Code-Explanation • Example • Positive and negative
  • 3. What is meant by algorithm COMPUTER INPUT OUTPUT PROBLEM ALGORITHM
  • 4. ALGORITHM • It is a step-by-step procedure to solve a problem • Algorithm provides an overview for solving and implementing problem • These algorithm decides the solution of the problem by implementing in procedural way
  • 6. ALGORITHM IN MACHINE LEARNING • IN the machine learning algorithm is categorized based on types of machine learning • Types of machine learning are Supervised machine learning Unsupervised machine learning Reinforcement machine learning.
  • 7. A computer is learn from past experience to do some task and measure performance then predict future. Many machine learning tasks can be solved & implemented by using some Algorithms.
  • 8. Category of K-NN algorithm Nearest neighbour is the kind of supervised learning These follow the instance based learning approach INSTANCE BASED LEARNING  The instance based stored presented training data in the memory ,when new instance is arrived a set of related instance is retrieved from memory and classified for new instance.  Instance based is used for more complex and symbolic data.
  • 9. Nearest neighbour  Nearest neighbour is conceptually straightforward approaches to approximating real-valued or discrete- valued target functions.  Instances are represented in this fashion and the process for identifying "neighbour ing" instances is elaborated accordingly
  • 10. How its work 1. Determine parameter value K 2. Calculate the distance between the query instance and training data 3. Sort the distance 4. Determine the nearest neighbour based kth distance. 5. Gather the category of the nearest instances according to k value 6. Predict the result by using simple majority instances
  • 11. Nearest neighbour The nearest neighbours of an instance are defined in terms of the standard Euclidean distance
  • 13. Code explanation • Training algorithm: f-Data f(x)-instance or pattern Example data • Classification algorithm: xq -query instance xl . . .xk -k instances which nearest to xq. The value should return if the given value is correct.
  • 14. Code explanation Here we have to compare each instance with new instance which is nearest instance V-distance between new instance and training data argmax-Average max distance between new and comparing training data i=1-initial value K-k instances  v belongs to V-each data is belongs to V
  • 15. Code explanation Here , If and b are comparing means it a and b is equals then pattern matches with training and new instances and returns 1. Otherwise 0 and not matching
  • 16. Example ACID DURABILITY STRENGHT CLASSIFICATION 7 7 Bad 7 4 Good 3 4 Good 1 4 Good 3 7 ? To find: Guess the classification of the new instance with x=3
  • 17. Example • Given: Step 1: Find the K=3 Step 2:Calculate the each instance distance with new instance (7-3)2+(7-7)2 = 4 (7-3)2+(7-4)2= 5
  • 19. Example • Step 3:Sort the calculated distance in ascending order The order is 1. 5 2. 4 3. 3 4. 0 5. 13
  • 20. Example • Step4:Pick neighbour ones with k=3 so, take first three instance 5,4 and 3 • Step 5 :find the category of the instances 5-Good 4-Bad 3-Good • Step6:Choose majority value as a result • The result of new instance is Good
  • 21. Positive of nearest neighbour  Simple to implement  Easy to understand  simple Algorithm  K-NN classification is best for local information  The result can be able to classify easily
  • 22. Negative of nearest neighbour  These cause over-fitting  Robust is noisy  Classify the new instance cost is high  Training data should be provided for classification