Machine Learning with K-Nearest Neighbors

with Hristina Hristova
4.8/5
(600)

Master K-Nearest Neighbors using Python’s scikit-learn library: from theoretical foundations to practical applications

1 hour of content 3688 students
Start for free

What you get:

  • 1 hour of content
  • 3 Interactive exercises
  • 8 Downloadable resources
  • World-class instructor
  • Closed captions
  • Q&A support
  • Future course updates
  • Course exam
  • Certificate of achievement

Machine Learning with K-Nearest Neighbors

Start for free

What you get:

  • 1 hour of content
  • 3 Interactive exercises
  • 8 Downloadable resources
  • World-class instructor
  • Closed captions
  • Q&A support
  • Future course updates
  • Course exam
  • Certificate of achievement
Start for free

What you get:

  • 1 hour of content
  • 3 Interactive exercises
  • 8 Downloadable resources
  • World-class instructor
  • Closed captions
  • Q&A support
  • Future course updates
  • Course exam
  • Certificate of achievement

What You Learn

  • Fully grasp the inner workings of the KNN algorithm as well as its practical application
  • Get acquainted with different distance metrics
  • Learn how to generate random datasets for practice
  • Understand the pros and cons of the KNN algorithm to make informed decisions in model selection
  • Develop the skills to independently plan, execute, and deliver a complete ML project from start to finish

Top Choice of Leading Companies Worldwide

Industry leaders and professionals globally rely on this top-rated course to enhance their skills.

Course Description

Practical knowledge of various machine learning algorithms is essential for machine learning enthusiasts and experts alike. In this course, we focus extensively on one of the most intuitive and easy-to-implement ML algorithms out there – K-nearest neighbors, or KNN for short. Step by step, we will first lay the foundations and expand your mathematical toolbox. Then, you will progress to coding and using Python’s scikit-learn library to solve a randomly generated classification problem. Finally, you will apply KNN to a couple of regression tasks. In other words – you will learn all the subtleties that should be considered when applying the KNN algorithm in your future practice.

Learn for Free

What does the course cover?

1.1 What does the course cover?

7 min

Motivation

1.2 Motivation

2 min

Math Prerequisites: Distance Metrics

1.3 Math Prerequisites: Distance Metrics

4 min

Setting up the Environment

2.1 Setting up the Environment

1 min

Installing the Relevant Packages

2.2 Installing the Relevant Packages

4 min

Random Dataset: Generating the Dataset

3.1 Random Dataset: Generating the Dataset

3 min

Curriculum

  • 1. KNN Classifier – Theory
    3 Lessons 13 Min

    In this introductory section, we motivate the usage of a K-Nearest Neighbor classifier and give 2 intuitive examples. Following that is a short math refresher where we talk about the various ways in which the distance between 2 points in space can be defined. This would later serve us well when building our KNN model in Python.

    What does the course cover?
    7 min
    Motivation
    2 min
    Math Prerequisites: Distance Metrics
    4 min
  • 2. Setting up the Environment
    2 Lessons 5 Min

    In advance of the hands-on part of the course, this section guides you through the installation process of relevant Python packages.

    Setting up the Environment Read now
    1 min
    Installing the Relevant Packages
    4 min
  • 3. KNN Classifier – Practical Example
    8 Lessons 37 Min

    To apply your skills in practice, you will first learn how to generate a random set of points, distribute them into 3 classes, and place them on the coordinate system. We will then use this dataset to train and test a KNN classification algorithm with the help of Python’s scikit-learn library. We will look at some edge cases that can arise during the classification process and discover how to handle them. Next, we will guide you through the process of building the so-called decision regions, which are a great way of visualizing the performance of your model. Finally, we will find out how to choose the best model parameters using a technique called ‘grid search’.

    Random Dataset: Generating the Dataset
    3 min
    Random Dataset: Visualizing the Dataset
    4 min
    Random Dataset: Classification
    7 min
    Random Dataset: How to Break a Tie
    3 min
    Random Dataset: Decision Regions
    6 min
    Random Dataset: Choosing the Best K-value
    5 min
    Random Dataset: Grid Search
    5 min
    Random Dataset: Model Performance
    4 min
  • 4. KNN Regressor
    3 Lessons 19 Min

    Continuing the practical part of the course, we will dive into solving regression tasks using the K-Nearest Neighbors method. Similar to what we did in the previous section, we will tackle this problem by generating 2 random datasets. One would represent a linear problem, while the other would be non-linear. We will apply a linear (parametric) model and a KNN (non-parametric model) on both datasets and argue which one performs better.

    Theory with a Practical Example
    8 min
    KNN vs Linear Regression: A Linear Problem
    7 min
    KNN vs Linear Regression: A Non-linear Problem
    4 min
  • 5. Pros and Cons of the KNN Algorithm
    1 Lesson 7 Min

    In this final section of the course, the pros and cons of the KNN algorithm are discussed at length. We will study this method’s limitations, together with its strong sides.

    Pros and Cons
    7 min

Topics

TheoryPythonmachine learningProgramming

Tools & Technologies

python

Course Requirements

  • You need to complete an introduction to Python before taking this course
  • It is highly recommended to take the Machine Learning in Python course first
  • You need to have Jupyter Notebook up and running

Who Should Take This Course?

Level of difficulty: Intermediate

  • Aspiring data scientists and ML engineers

Exams and Certification

A 365 Data Science Course Certificate is an excellent addition to your LinkedIn profile—demonstrating your expertise and willingness to go the extra mile to accomplish your goals.

Exams and certification

Meet Your Instructor

Hristina Hristova

Hristina Hristova

Head of Data Content at

5 Courses

1581 Reviews

13075 Students

Hristina Hristova is a Theoretical Physicist with experience in the fields of mathematics, physics, programming, and the creation of various educational content. For several years now, she has been tutoring physics and mathematics students online, following educational programs such as The IB Diploma, Cambridge IGCSE, and Cambridge AS & A Level, among many others. Hristina’s high qualification and adaptive teaching style have helped plenty of students successfully pass their exams, while also enjoying the learning process.

What Our Learners Say

21.11.2024
21.11.2024
Amazing course !

365 Data Science Is Featured at

Our top-rated courses are trusted by business worldwide.

Recommended Courses