Deep Learning Capstone — When DL Wins vs When ML Is Enough
Lesson opener
In one line: How to decide: classical ML, custom neural net, or transfer learning.
Why it matters: Deep learning on 300 churn rows rarely beats tuned random forest - but wins on catalog photos.
Before this lesson: ML capstone / Transfer learning
Before you start
| Resource | Link |
|---|---|
| Previous | Transfer learning |
| Next | What Generative AI is |
| Prerequisites | ML capstone, Transfer learning |
| Time | ~90 minutes |
What you will learn
- How to decide: classical ML, custom neural net, or transfer learning
- End-to-end capstone comparing approaches on the same business problem
- Deployment realism — data size, latency, explainability, maintenance
- Where to go next: Generative AI or review ML capstone
The decision framework
The problem it solves: Leadership says "use AI" for everything. You must recommend the simplest tool that meets the metric — not the flashiest notebook.
| Signal | Prefer classical ML (ml1–ml12) | Prefer deep learning (dl1–dl7) |
|---|---|---|
| Data type | Tabular CSV, SQL exports | Images, audio, long text |
| Sample size | Hundreds–low millions rows | Thousands+ images or millions of tokens |
| Interpretability | Must explain every decision | Score acceptable; saliency maps optional |
| Compute | Laptop, minutes | GPU helpful for CNNs/transformers |
| Team skill | pandas + sklearn | Keras, data pipelines |
WHY Deep learning on 300 churn rows rarely beats tuned random forest — but wins on catalog photos.
WHEN Scoping any new project — fill this table before importing TensorFlow.
Capstone scenario — two problems, one company
Company: Pan-India D2C kitchenware brand (HQ: Pune).
Problem A — Churn: 8,000 subscribers, tabular CRM features → retention calls
Problem B — Catalog: 15,000 product photos, 12 categories → auto-tag uploads
You will solve both and compare stacks.
Problem A — Churn (stick with sklearn)
Reuse ML capstone pipeline:
import pandas as pd
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score, classification_report
df = pd.read_csv("data/customers.csv")
X = pd.get_dummies(
df[["tenure_months", "monthly_spend", "support_tickets", "segment",
"total_orders", "total_revenue"]],
drop_first=True,
)
y = df["churned"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42, stratify=y)
rf = RandomForestClassifier(n_estimators=100, max_depth=6, class_weight="balanced", random_state=42)
scores = cross_val_score(rf, X_train, y_train, cv=5, scoring="roc_auc")
rf.fit(X_train, y_train)
proba_rf = rf.predict_proba(X_test)[:, 1]
print(f"CV AUC: {scores.mean():.3f}")
print(f"Test AUC: {roc_auc_score(y_test, proba_rf):.3f}")Verdict for Problem A: Deploy random forest — interpretable feature_importances_, fast scoring, no GPU. Neural net from dl3 is optional experiment, not production default.
Problem B — Product photos (transfer learning)
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
IMG = 128
rng = np.random.default_rng(7)
n = 600
X = rng.random((n, IMG, IMG, 3)).astype("float32")
y = rng.integers(0, 12, n)
split = int(0.8 * n)
X_train, X_test = X[:split], X[split:]
y_train, y_test = y[:split], y[split:]
base = MobileNetV2(input_shape=(IMG, IMG, 3), include_top=False, weights="imagenet")
base.trainable = False
model = keras.Sequential([
layers.Input(shape=(IMG, IMG, 3)),
layers.Lambda(preprocess_input),
base,
layers.GlobalAveragePooling2D(),
layers.Dense(64, activation="relu"),
layers.Dropout(0.3),
layers.Dense(12, activation="softmax"),
])
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
model.fit(X_train, y_train, validation_split=0.2, epochs=8, batch_size=32, verbose=0)
test_acc = model.evaluate(X_test, y_test, verbose=0)[1]
print(f"Product classifier test accuracy: {test_acc:.3f}")Verdict for Problem B: Transfer learning — classical ML has no natural input for raw pixels; flatten+Dense would overfit.
Side-by-side summary
| Churn (A) | Catalog (B) | |
|---|---|---|
| Best tool | Random forest + GridSearch | MobileNetV2 + frozen base |
| Test metric | ROC AUC ~0.75–0.85 (data dependent) | Top-1 accuracy |
| Explainability | Feature importance | Confusion matrix per category |
| Inference | Milliseconds on CPU | Tens of ms — batch on GPU |
| Maintenance | Retrain monthly on CSV | Retrain when new product lines |
When deep learning is overkill
| Request | Overkill DL | Do instead |
|---|---|---|
| Churn on 500 rows | 5-layer MLP | Logistic regression or forest |
| Sentiment on 200 reviews | BERT fine-tune | TF-IDF + logistic (dl6) |
| Sales forecast | LSTM | Linear regression + seasonality features |
| "Use ChatGPT" for SQL | LLM | SQL course + validated queries |
WHY Simpler models debug faster, run cheaper, and satisfy auditors.
WHEN Stakeholders conflate "AI" with "deep learning" — show this table.
When deep learning is justified
- Millions of behavioural events with embeddings (recommendation)
- Images/video where CNNs or video nets are SOTA
- Speech and machine translation for Indian language support at scale
- Generative marketing copy — pair AI prompting with human review
Capstone deliverables
- Decision memo (1 page) — Problem A vs B tool choice with metrics
- Churn — sklearn model + threshold for top-50 weekly calls (ml12)
- Catalog — transfer learning notebook with confusion matrix
- Ethics — no discriminatory use of churn scores; photo model bias check across sellers
- Monitoring — monthly AUC drift for churn; accuracy on new categories
What you have learned across ML + DL
Data (pandas) → Features → Classical ML (sklearn) → Metrics → Business action
↓
Neural nets (Keras) when data/modality demands it
↓
Transfer learning when labels are scarce on images/textReview anytime: ML workflow / Churn capstone / Neural networks
Practice
Do this now: Write a one-page decision memo for the Pune D2C scenario. Include: (1) tool chosen per problem with metric, (2) one reason DL was rejected for churn, (3) one reason DL was required for photos, (4) next step linking to Business Analytics for KPI dashboards or ML capstone review to refine churn.
Checklist
- [ ] Decision framework applied to tabular vs image problems
- [ ] Churn solved with sklearn; photos with transfer learning
- [ ] "DL overkill" examples documented
- [ ] Deliverables list completed or planned
- [ ] Next: BA Introduction — or review Churn capstone