Skip to content

Add SVM lesson: Hard-margin vs Soft-margin with interactive demo - #14

Merged
LMK89 merged 1 commit into
mainfrom
claude/quirky-planck-7te258
Sep 1, 2026
Merged

Add SVM lesson: Hard-margin vs Soft-margin with interactive demo#14
LMK89 merged 1 commit into
mainfrom
claude/quirky-planck-7te258

Conversation

@LMK89

@LMK89 LMK89 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

Added a comprehensive Vietnamese-language educational lesson on Support Vector Machines (SVM), focusing on the practical differences between Hard-margin and Soft-margin approaches with real-world credit risk classification examples.

Key Changes

  • New lesson file: 2026-08-31-svm-support-vector-machine-28b46348.html (643 lines)

    • Complete HTML5 lesson with embedded CSS and JavaScript
    • Dark/light theme toggle with localStorage persistence
    • Responsive design with CSS Grid and Flexbox
  • Content structure:

    • Quick warmup quiz (3 questions) to assess prior knowledge
    • Concise SVM definition with mathematical notation
    • Real-world scenario: bank credit risk scoring (1D classification)
    • Four detailed state comparisons showing SVM behavior:
      • Hard-margin with clean data (ideal case)
      • Hard-margin with outliers (infeasible/fails)
      • Soft-margin with large C (overfits to noise)
      • Soft-margin with reasonable C (robust solution)
    • Comparative summary table
    • Interactive demo: visualize threshold selection with/without outliers
    • Data quality guidelines (good vs bad practices)
    • Self-check quiz (3 questions with instant feedback)
  • Interactive features:

    • Toggle outlier inclusion in demo dataset
    • Radio buttons to switch between Hard-margin and Soft-margin modes
    • Animated number line visualization showing data points and decision threshold
    • Step-by-step solver output with color-coded feedback
    • Warmup and quiz scoring with localStorage support
  • Updated README: Added entry linking to the new SVM lesson

Notable Implementation Details

  • Uses 1D (univariate) classification for manual calculation accessibility
  • Demonstrates why Hard-margin fails on real data through concrete example (B0 outlier)
  • Emphasizes the C parameter's role in balancing margin width vs. training error tolerance
  • All styling uses CSS custom properties for theme switching
  • JavaScript animations (fadeInDown, slideUp, slideDown, pulse) for progressive disclosure
  • No external dependencies — pure HTML/CSS/JavaScript

https://claude.ai/code/session_011NfjZZebBNSnmoi6X4RMN1

… margin

Interactive Vietnamese lesson on Support Vector Machine following the
existing Claude-lession format: 4 states (clean hard-margin, infeasible
hard-margin with outlier, overfitting with large C, tuned soft-margin C),
comparison table, step-by-step demo, quiz. Updates the lesson index.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011NfjZZebBNSnmoi6X4RMN1
@LMK89
LMK89 merged commit 564a29c into main Sep 1, 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