Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
KNN Algorithm
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
▪ What is KNN Algorithm?
▪ Industrial Use case of KNN Algorithm
▪ How things are predicted using KNN Algorithm
▪ How to choose the value of K?
▪ KNN Algorithm Using Python
▪ Implementation of KNN Algorithm from scratch
▪ Compare the built model using scikit learn
Agenda for Today’s Session
“K Nearest Neighbour is a simple algorithm that stores
all the available cases and classifies the new data or
case based on a similarity measure.”What is
KNN
Algorithm?
What is K in
KNN
Algorithm?
K = Number of Nearest Neighbors
Industrial
Application of
KNN
Algorithm
Copyright © 2018, edureka and/or its affiliates. All rights reserved.
Industrial
Application of
KNN
Algorithm
Copyright © 2018, edureka and/or its affiliates. All rights reserved.
How does a KNN
Algorithm
work?
CLASS A
CLASS B
How does a KNN
Algorithm
work?
CLASS A
CLASS B
How does a KNN
Algorithm
work?
CLASS A
CLASS B
K= 3
How does a KNN
Algorithm
work?
CLASS A
CLASS B
K= 6
How to choose
the value of K
How things are
predicted using
KNN
Algorithm?
Euclidean Distance
How things are
predicted using
KNN
Algorithm?
Manhattan Distance
How things are
predicted using
KNN
Algorithm?
Manhattan Distance
vs
Euclidean Distance
Why KNN
Algorithm is a
?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DEMO
Let’s learn to
code
© MadeByShape Ltd. Web Design Manchester 2018. All Rights Reserved.
Iris Dataset
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
KNN: Step by Step
Accuracy
Summarizing the accuracy of
predictions.
Handle Data
Open the dataset from CSV and split
into test/train datasets.
Main
Tie it all together
Neighbors
Locate k most similar data instances
Similarity
Calculate the distance between two
data instances
Response
Generate a response from a set of
data instance
Copyright © 2017, edureka and/or its affiliates. All rights reserved.

KNN Algorithm using Python | How KNN Algorithm works | Python Data Science Training | Edureka

  • 1.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved.
  • 2.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. KNN Algorithm
  • 3.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. ▪ What is KNN Algorithm? ▪ Industrial Use case of KNN Algorithm ▪ How things are predicted using KNN Algorithm ▪ How to choose the value of K? ▪ KNN Algorithm Using Python ▪ Implementation of KNN Algorithm from scratch ▪ Compare the built model using scikit learn Agenda for Today’s Session
  • 4.
    “K Nearest Neighbouris a simple algorithm that stores all the available cases and classifies the new data or case based on a similarity measure.”What is KNN Algorithm?
  • 5.
    What is Kin KNN Algorithm? K = Number of Nearest Neighbors
  • 6.
    Industrial Application of KNN Algorithm Copyright ©2018, edureka and/or its affiliates. All rights reserved.
  • 7.
    Industrial Application of KNN Algorithm Copyright ©2018, edureka and/or its affiliates. All rights reserved.
  • 8.
    How does aKNN Algorithm work? CLASS A CLASS B
  • 9.
    How does aKNN Algorithm work? CLASS A CLASS B
  • 10.
    How does aKNN Algorithm work? CLASS A CLASS B K= 3
  • 11.
    How does aKNN Algorithm work? CLASS A CLASS B K= 6
  • 12.
  • 13.
    How things are predictedusing KNN Algorithm? Euclidean Distance
  • 14.
    How things are predictedusing KNN Algorithm? Manhattan Distance
  • 15.
    How things are predictedusing KNN Algorithm? Manhattan Distance vs Euclidean Distance
  • 16.
  • 17.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. DEMO Let’s learn to code © MadeByShape Ltd. Web Design Manchester 2018. All Rights Reserved.
  • 18.
  • 19.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved. KNN: Step by Step Accuracy Summarizing the accuracy of predictions. Handle Data Open the dataset from CSV and split into test/train datasets. Main Tie it all together Neighbors Locate k most similar data instances Similarity Calculate the distance between two data instances Response Generate a response from a set of data instance
  • 20.
    Copyright © 2017,edureka and/or its affiliates. All rights reserved.