From the course: Introduction to Data Science
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Implementing k-Nearest Neighbors
From the course: Introduction to Data Science
Implementing k-Nearest Neighbors
In this lesson, I'll go over an example of implementing the K-Nearest Neighbors or K-NN algorithm. Let's say you have a data set that was collected to help doctors diagnose chronic kidney disease or CKD. Each row in the data set represents a patient who was treated in the past and whose diagnosis is known. For each patient, you have a set of measurements from a blood test. Your goal is to develop a way to classify future patients, as has CKD or doesn't have CKD based on their blood test results. I've opened up the exercise file for this lesson. Feel free to open the exercise file on your end as well to follow along. In the first code cell, I started by importing all the python libraries that I'll need. This includes imports from Pandas, Matplotlib, Seaborn and Sklearn. Sklearn is another powerful library for data science. It contains many useful methods for implementing machine learning algorithms in Python. You can learn more about it using the link in the resource file. Next, I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Defining prediction for data science1m 46s
-
(Locked)
Navigating classification2m 7s
-
(Locked)
Recognizing the k-NN algorithm3m 13s
-
(Locked)
Implementing k-Nearest Neighbors7m 29s
-
(Locked)
Navigating regression2m 52s
-
(Locked)
Checking assumptions of regression2m 20s
-
(Locked)
Implementing linear regression6m 9s
-
(Locked)
-