Lab Details
Patterns to Predictions: Machine Learning Foundations With K-Nearest Neighbors [Python]
This lab package includes two assignment worksheets that guide students through hands-on applications of the K-Nearest Neighbors (KNN) algorithm. It also contains two sample solution files, which are visible to educator users only and provide reference implementations for the assignment exercises. In addition, a supplementary document is provided with detailed variable definitions, dataset descriptions, and explanations of key features used throughout the coding examples and assignments. Together, these materials support both instruction and independent learning by connecting the concepts presented in the case study with practical implementation.
After studying the case and the lab practice, students will be able to:
1. Translate a business challenge into a predictive machine learning task, and understand why complex data requires flexible algorithms like K-Nearest Neighbors (KNN) instead of simple linear rules.
2. Prepare data for distance-based modeling, understanding why techniques like feature scaling and categorical encoding are necessary to ensure accurate predictions.
3. Tune the model by adjusting basic settings such as the number of neighbors (K) and distance weighting, and explain how these choices affect the algorithm's predictions.
4. Build a basic machine learning pipeline in Python, and evaluate the model’s performance by comparing its accuracy against a simple baseline.