|
@@ -0,0 +1,78 @@
|
|
|
|
|
+# Textbook Compiler Workflow
|
|
|
|
|
+
|
|
|
|
|
+## Overview
|
|
|
|
|
+
|
|
|
|
|
+This skill converts mathematical textbooks into interactive, hands-on courseware with a hacker mindset: treat formulas as legacy code to refactor.
|
|
|
|
|
+
|
|
|
|
|
+## Source Textbooks
|
|
|
|
|
+
|
|
|
|
|
+Located at `/mnt/ai/textbooks/`:
|
|
|
|
|
+
|
|
|
|
|
+1. **lihang-code** - Statistical Learning Methods (李航)
|
|
|
|
|
+ - Phase 1: Symbol desensitization
|
|
|
|
|
+ - Topics: Convex optimization, curse of dimensionality
|
|
|
|
|
+
|
|
|
|
|
+2. **d2l-zh** - Dive into Deep Learning
|
|
|
|
|
+ - Phase 2: Deep dive
|
|
|
|
|
+ - Topics: Computational graphs, automatic differentiation, tensor mappings
|
|
|
|
|
+
|
|
|
|
|
+3. **Book-Mathematical-Foundation-of-Reinforcement-Learning**
|
|
|
|
|
+ - Phase 3: RL Math Foundations
|
|
|
|
|
+ - Topics: State spaces, MDPs, dynamic agent interaction
|
|
|
|
|
+
|
|
|
|
|
+## Compilation Pipeline
|
|
|
|
|
+
|
|
|
|
|
+### Step 1: Parse Source
|
|
|
|
|
+```bash
|
|
|
|
|
+python3 scripts/compile-textbook.py --source /mnt/ai/textbooks/d2l-zh --output staging/
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Step 2: Generate Courseware (6 Modules)
|
|
|
|
|
+For each day's content:
|
|
|
|
|
+1. **Learning Objectives** - What you'll learn
|
|
|
|
|
+2. **Core Concepts** - Key ideas with visual intuition
|
|
|
|
|
+3. **Symbol Decoder** - Translate math to code
|
|
|
|
|
+4. **The Math** - Core derivations (strict LaTeX)
|
|
|
|
|
+5. **Optimization Bottlenecks** - Engineering considerations
|
|
|
|
|
+6. **OJ Mission** - Hands-on coding exercise
|
|
|
|
|
+
|
|
|
|
|
+### Step 3: Create Exercises
|
|
|
|
|
+- Use `templates/exercise_template.py`
|
|
|
|
|
+- Implement from scratch with numpy/torch
|
|
|
|
|
+- No high-level APIs (torch.nn forbidden)
|
|
|
|
|
+
|
|
|
|
|
+### Step 4: Generate Tests
|
|
|
|
|
+- Use `templates/test_template.py`
|
|
|
|
|
+- Shape assertions
|
|
|
|
|
+- Numerical correctness checks with `np.testing.assert_allclose`
|
|
|
|
|
+
|
|
|
|
|
+## Cron Schedule
|
|
|
|
|
+
|
|
|
|
|
+| Job | Schedule | Action |
|
|
|
|
|
+|-----|----------|--------|
|
|
|
|
|
+| weekend-batch-compile | Sat 10:00 AM | Generate 7 days of materials |
|
|
|
|
|
+| daily-deploy | Daily 14:00 PM | Deploy + git push + notify |
|
|
|
|
|
+
|
|
|
|
|
+## Output Structure
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+staging/
|
|
|
|
|
+├── course_day1.html
|
|
|
|
|
+├── course_day2.html
|
|
|
|
|
+├── ...
|
|
|
|
|
+├── exercises/
|
|
|
|
|
+│ ├── day1_task.py
|
|
|
|
|
+│ ├── day2_task.py
|
|
|
|
|
+│ └── ...
|
|
|
|
|
+└── tests/
|
|
|
|
|
+ ├── test_day1.py
|
|
|
|
|
+ ├── test_day2.py
|
|
|
|
|
+ └── ...
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+## Deployment
|
|
|
|
|
+
|
|
|
|
|
+Daily at 14:00 PM:
|
|
|
|
|
+1. Move from `staging/` to `courseware/`, `exercises/`, `tests/`
|
|
|
|
|
+2. Git commit and push
|
|
|
|
|
+3. Send Telegram notification
|