Rana Maninder Singh
Lesson 8 of 8Deep Learning

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

ResourceLink
PreviousTransfer learning
NextWhat Generative AI is
PrerequisitesML 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.

SignalPrefer classical ML (ml1–ml12)Prefer deep learning (dl1–dl7)
Data typeTabular CSV, SQL exportsImages, audio, long text
Sample sizeHundreds–low millions rowsThousands+ images or millions of tokens
InterpretabilityMust explain every decisionScore acceptable; saliency maps optional
ComputeLaptop, minutesGPU helpful for CNNs/transformers
Team skillpandas + sklearnKeras, 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 toolRandom forest + GridSearchMobileNetV2 + frozen base
Test metricROC AUC ~0.75–0.85 (data dependent)Top-1 accuracy
ExplainabilityFeature importanceConfusion matrix per category
InferenceMilliseconds on CPUTens of ms — batch on GPU
MaintenanceRetrain monthly on CSVRetrain when new product lines

When deep learning is overkill

RequestOverkill DLDo instead
Churn on 500 rows5-layer MLPLogistic regression or forest
Sentiment on 200 reviewsBERT fine-tuneTF-IDF + logistic (dl6)
Sales forecastLSTMLinear regression + seasonality features
"Use ChatGPT" for SQLLLMSQL 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


Capstone deliverables

  1. Decision memo (1 page) — Problem A vs B tool choice with metrics
  2. Churn — sklearn model + threshold for top-50 weekly calls (ml12)
  3. Catalog — transfer learning notebook with confusion matrix
  4. Ethics — no discriminatory use of churn scores; photo model bias check across sellers
  5. 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/text

Review 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