KNN Classification
Homework 1 covers K-Nearest Neighbors classification with cross-validation techniques, exploring confidence bands, leave-one-out CV, and k-fold validation on simulated classification data.
Learning Objectives
- Implement K-Nearest Neighbors classification from scratch
- Understand bias-variance tradeoff in choosing K
- Apply leave-one-out and k-fold cross-validation
- Construct and interpret confidence bands for error rates
ESLII Reference
This homework draws from Chapter 2 (Overview of Supervised Learning) and Chapter 7 (Model Assessment and Selection) of Elements of Statistical Learning, 2nd Edition.
Available Scripts
| Script | Description | Subdirectory |
|---|---|---|
sim_data.py |
Generate simulated classification data with known class boundaries | 1/ |
knn.py |
K-Nearest Neighbors implementation with configurable K | 1/ |
cv.py |
Cross-validation utilities (LOO-CV and k-fold) | 1/ |
report.py |
Generate analysis report with visualizations | 1/ |
Quick Start
# CLI exploration
cd domains/Stan/cli
python main.py "homework 1"
# Cockpit GUI
cd domains/Stan/cockpit
python stan_cockpit.py
# Enter: "explore homework 1 KNN classification"
# Direct tool access
from unified_agent import StanDataClient, ToolRegistry
client = StanDataClient()
tools = ToolRegistry(client)
result = tools.get_tool('load_hmk1_info')({})
Related Tools
| Tool | Description |
|---|---|
load_hmk1_info |
Get Homework 1 metadata and available scripts |
list_hmk1_scripts |
List all Python scripts in the Hmk1 directory |
find_by_technique |
Search homeworks by technique (e.g., "KNN") |
compare_homeworks |
Compare this homework with others |