Skip to content

Add K-Nearest Neighbors interactive lesson in Vietnamese - #12

Merged
LMK89 merged 1 commit into
mainfrom
claude/quirky-planck-3ctsd7
Aug 30, 2026
Merged

Add K-Nearest Neighbors interactive lesson in Vietnamese#12
LMK89 merged 1 commit into
mainfrom
claude/quirky-planck-3ctsd7

Conversation

@LMK89

@LMK89 LMK89 commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Added a comprehensive interactive educational lesson on K-Nearest Neighbors (KNN) algorithm in Vietnamese, including visual demonstrations, interactive demos, and self-grading quizzes.

Changes

  • New lesson file: 2026-08-29-knn-k-nearest-neighbors-1600b4a3.html

    • Complete HTML5 lesson with embedded CSS and JavaScript
    • Dark/light theme toggle with localStorage persistence
    • Responsive design (mobile-friendly)
  • Content sections:

    • Quick warmup quiz (3 questions) to activate prior knowledge
    • Formal definition of KNN algorithm with ASCII visualization
    • Real-world example: fruit classification (apples vs oranges) with sample dataset
    • Four detailed state comparisons (k=1, optimal k, k too large, missing data normalization)
    • Comprehensive comparison table
    • Interactive step-by-step demo calculating Euclidean distances and voting
    • Good vs bad data characteristics
    • Self-grading quiz with 3 conceptual questions
  • Interactive features:

    • Warmup section with fill-in-the-blank and matching exercises
    • Live KNN demo: input new fruit properties, select k value, see distance calculations and voting results
    • Random data generator for demo exploration
    • Quiz with instant feedback and scoring
  • Updated README.md: Added entry for the new KNN lesson to the course index

Implementation Details

  • Uses CSS custom properties (CSS variables) for theming
  • Smooth animations (fadeInDown, slideUp, slideDown, pulse) for visual feedback
  • Euclidean distance calculation: √((x₁-x₂)² + (y₁-y₂)²)
  • Vote-based classification with tie-breaking
  • Responsive grid layout (single column on mobile, two columns on desktop)
  • No external dependencies — pure HTML/CSS/JavaScript

https://claude.ai/code/session_01T2h1h1r7crG2ubboi4uKR5

Thêm bài giảng HTML tương tác: lazy learning, đánh đổi overfit/underfit
khi chọn k, và tầm quan trọng của chuẩn hoá dữ liệu trước khi tính
khoảng cách. Có demo tính tay từng bước (phân loại Táo/Cam), khởi động
nhanh và quiz tự chấm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2h1h1r7crG2ubboi4uKR5
@LMK89
LMK89 merged commit 68ad4cc into main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants