No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

KNN & Classification

Unit 3: Required

Materials We Provide

Topic Description Link
Lesson K-Nearest Neighbors with Scikit-Learn Here
Solution Solution code for lesson prompts Here
Data 2015 Season Statistics for ~500 NBA Players Here
The Iris Dataset (Flowers) Here
Practice Two sample activities to practice KNN Here

Learning Objectives

After this lesson, students should be able to:

  • Utilize the KNN model on the iris data set.
  • Implement scikit-learn's KNN model.
  • Assess the fit of a KNN Model using scikit-learn.

Student Requirements

Before this lesson(s), students should already be able to:

  • Load, explore, and manipulate data using Pandas
  • Create simple visualizations with Matplotlib
  • Interpret statistical information from box and scatter plots
  • Describe the statistical meaning of an "error"

Lesson Outline

TOTAL (170 min)

  • Learning Objectives (5 min)
  • Overview of the Iris Data Set (10 min)
    • Terminology
  • Exercise: "Human Learning" With Iris Data (60 min)
  • Human Learning on the Iris Data Set (10 min)
  • K-Nearest Neighbors (KNN) Classification (30 min)
    • Using the Train/Test Split Procedure (K=1)
  • Tuning a KNN Model (30 min)
    • What Happens If We View the Accuracy of our Training Data?
    • Training Error Versus Testing Error
  • Standardizing Features (15 min)
    • Use StandardScaler to Standardize our Data.
  • Comparing KNN With Other Models (10 min)

Additional Resources

For more information on this topic, check out the following resources: