Month 2-Week 1: Classical ML-picking a course and shipping a real classifier¶
Week summary¶
- Goal: Commit to a classical-ML course (fast.ai or Andrew Ng), do its first 1–2 modules, and ship a real image classifier with train/val/test discipline.
- Time: ~9 h over 3 sessions.
- Output: New repo
classical-mlwith course-week notebooks and a deployed image classifier (Hugging Face Space if on fast.ai). - Sequences relied on: 06-classical-ml rungs 01–04; 05-pytorch rungs 04–06.
Why this week matters¶
You can do modern AI without classical ML, but not well. The discipline of train/val/test, baseline-first thinking, regularization, and bias-variance is what separates "tinkerer" from "engineer." This is the discipline you'll apply when curating LLM fine-tuning datasets, evaluating RAG corpora, and reading papers.
Picking one course and finishing the foundations is the move. Both fast.ai and Andrew Ng's specialization are legitimate; either path works. Decide on Monday and don't second-guess. Your engineering background and existing from-scratch implementations make fast.ai the better fit (top-down, code-first, treats you as smart). But honor your own preference.
Prerequisites¶
- M01 complete.
- A working PyTorch training loop.
- Optionally, a GPU (Colab free tier or Kaggle is fine).
Recommended cadence¶
- Session A-Tue/Wed evening (~3 h): course lecture 1 + setup
- Session B-Sat morning (~3.5 h): course lecture 2 + classifier build
- Session C-Sun afternoon (~2.5 h): deploy/demonstrate + reflect
Session A-Choose path, set up, lecture 1¶
Goal: Course chosen, environment ready, first lecture absorbed.
Part 1-Choose path + reasoning (30 min)¶
fast.ai (Practical Deep Learning v5)-top-down, code-first, builds image classifier in lesson 1. Excellent if you want to ship fast and learn through doing.
Andrew Ng (ML Specialization)-bottom-up, math-first, more lectures with quizzes. Excellent if you want comprehensive theoretical grounding.
My recommendation given your profile: fast.ai. You've already done the from-scratch math.
Document the choice in classical-ml/LEARNING_LOG.md:
Chose [fast.ai / Ng] because [3-sentence reason]. Plan: complete weeks 1–4 of M02 using this course.
Part 2-Environment setup (45 min)¶
fast.ai path:
- Read course.fast.ai "Setup" page.
- Pick: Colab (free), Paperspace (better GPU, cheap), Kaggle (free, decent GPU), or local if you have one.
- Confirm import fastai works.
Ng path: - Sign up for Coursera (audit free). - Confirm Jupyter access for labs.
Part 3-Lecture 1 deeply (90 min)¶
fast.ai Lesson 1: - Watch the full lecture (~80 min). - The key concept: a state-of-the-art image classifier in <10 lines of code. - Run the notebook. Train a classifier on a small dataset (cats/dogs or birds).
Ng Course 1, Week 1: - Watch the lectures. - Complete the "Linear regression with one variable" lab.
Take notes in your repo. What surprised you? What was familiar?
Output of Session A¶
classical-ml/repo created withLEARNING_LOG.mdand a notebook from lecture 1.
Session B-Lecture 2 + ship a real classifier¶
Goal: Complete lecture 2's material. Build a real image classifier on a dataset of your choice.
Part 1-Lecture 2 (90 min)¶
fast.ai Lesson 2: - Watch. - Key concepts: production deployment; data cleaning; model export. - The deliverable is a deployed classifier on Hugging Face Spaces.
Ng Course 1, Week 2-3: - Watch and complete labs through linear regression with multiple variables.
Part 2-Build a real classifier (90 min)¶
Pick a domain that matters to you. Examples: - Bird species (fast.ai's classic). - Plant disease detection. - A two-class problem from your work (e.g., screenshot of healthy vs unhealthy CI dashboard).
fast.ai workflow (10 lines):
from fastai.vision.all import *
path = untar_data(URLs.PETS)/'images'
def is_cat(x): return x[0].isupper()
dls = ImageDataLoaders.from_name_func('.', get_image_files(path), valid_pct=0.2,
seed=42, label_func=is_cat, item_tfms=Resize(224))
learn = vision_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(3)
Aim for: 95%+ validation accuracy on a problem of moderate difficulty.
Part 3-Train/val/test discipline (45 min)¶
Internalize: - Train set: what the model fits on. - Validation set: what you tune hyperparameters against. NEVER look at test during tuning. - Test set: what you report on, used once at the end.
Common mistake: tuning hyperparameters on test → optimistic numbers → production disappointment.
Add to your notebook: a clear cell labelled "Final test evaluation-only run after all tuning."
Output of Session B¶
- A trained classifier with reported metrics on a held-out test set.
Session C-Deploy / demonstrate + reflect¶
Goal: Make the classifier accessible (deployed on a Space, or via a Gradio demo). Reflect on what classical ML adds beyond from-scratch.
Part 1-Deploy as a Hugging Face Space (75 min)¶
fast.ai path: Lesson 2 covers exactly this. Export learn.export(), write a small Gradio app, push to Hugging Face Spaces (free). End result: a public URL where anyone can upload an image and get a prediction.
Ng path: Skip deployment this week; do a live demo cell in your notebook with file upload via ipywidgets.
# minimal Gradio app for fast.ai
import gradio as gr
from fastai.vision.all import *
learn = load_learner('export.pkl')
def predict(img):
pred, _, probs = learn.predict(img)
return {str(c): float(p) for c, p in zip(learn.dls.vocab, probs)}
gr.Interface(fn=predict, inputs="image", outputs="label").launch()
Part 2-Reflection (45 min)¶
Write a 300-word section in your notebook: "What did this week add beyond M01's from-scratch work?"
Likely answers: - Pretrained models (transfer learning) crush from-scratch on real data. - Data augmentation matters as much as model choice. - The whole "from raw data → deployed app" loop has failure modes from-scratch never hit.
Part 3-Forward look (30 min)¶
- Read M02-W02.md.
- Skim fast.ai lesson 3 (or Ng Course 2 week 1).
- Set Sunday-evening intent: tomorrow you experiment with three model variants.
Output of Session C¶
- A deployed (or live-demo) classifier.
- 300-word reflection in repo.
End-of-week artifact¶
-
classical-ml/repo with course-week 1+2 notebooks - A trained classifier with test metrics
- (Optional) Deployed Hugging Face Space
- Reflection committed
End-of-week self-assessment¶
- I can articulate why train/val/test discipline matters.
- I can train a transfer-learning classifier in <30 min on a new dataset.
- I have one course-aligned learning rhythm I can sustain for 3 more weeks.
Common failure modes for this week¶
- Course-shopping forever. Decide Monday, commit.
- Skipping the test/val discipline because "it's just a project." Build the muscle now.
- Deploying nothing. Public artifacts compound. Even a half-broken Space is better than a perfect private notebook.
What's next (preview of M02-W02)¶
Course week 3 + an ablation study with seed variance. You'll run 3 model variants × 3 seeds and report results with confidence intervals-the rigor that distinguishes engineers from tinkerers.