BitWithBite
/
Classical Machine Learning
Progress
0%
TIER 2

Classical
Machine Learning

The algorithms that power most real-world production ML — fraud detection, recommendation engines, forecasting, segmentation. Not deep learning yet, but everything that came before it and still runs the world.

10
Modules
55
Lessons
5
Labs
3
Projects
~18h
Est. time
⚠ Prerequisite: Tier 1 — AI & ML Foundations (or equivalent Python + math basics)
MOD 01
The scikit-learn Workflow
Master the API that powers real-world ML — pipelines, preprocessing, and serialization.
4 lessons 1 lab

What you'll learn

  • How scikit-learn's Estimator API is designed
  • Building reusable Pipeline objects
  • Preprocessing raw data correctly
  • Saving models for production use

Tools used

  • scikit-learn Pipelines
  • StandardScaler, OneHotEncoder
  • ColumnTransformer
  • joblib, pickle
1.1
Estimators, transformers, and pipelines
The three object types in scikit-learn's design, and why the API is shaped the way it is. fit(), transform(), predict() — what each does and when to call which.
codeconcept
25 min
1.2
Preprocessing: scaling, normalization, encoding
StandardScaler vs MinMaxScaler vs RobustScaler — when each matters and when it doesn't. Label encoding vs OneHotEncoder. Why you fit on train and transform on test (and the silent bug when you don't).
codeconcept
30 min
1.3
Building a full Pipeline object
Chain preprocessing and a model into a single object. ColumnTransformer for mixed-type data (numeric + categorical in one pass). Why pipelines prevent data leakage and make cross-validation safe.
codelab
35 min
1.4
Saving and loading models
pickle vs joblib — why joblib wins for large NumPy arrays. Saving the whole pipeline (not just the model). Version warnings and what breaks when sklearn versions don't match in production.
codeproduction
20 min
MOD 02
Decision Trees & Ensembles
From a single tree that overfits to XGBoost winning Kaggle competitions — understand the full progression.
5 lessons 1 lab

What you'll learn

  • How trees split data (entropy, Gini impurity)
  • Why single trees overfit and how ensembles fix that
  • Bagging (Random Forests) vs boosting (XGBoost)
  • How to read and trust feature importances

Tools used

  • DecisionTreeClassifier / Regressor
  • RandomForestClassifier
  • XGBoost, LightGBM
  • SHAP (feature importance)
2.1
Decision trees: how splits are chosen
Information gain, entropy, and Gini impurity — built up from scratch with a worked example. Reading a visualized decision tree. Why trees are "white box" models that humans can actually inspect.
mathcode
35 min
2.2
Overfitting in trees, and pruning
A deep tree memorizes training data. max_depth, min_samples_leaf, and cost-complexity pruning as controls. Visualizing the bias-variance curve as you change depth.
codeconcept
25 min
2.3
Random forests — the bagging intuition
Why averaging many weak, diverse models beats one strong model. Bootstrap sampling and feature subsampling — two sources of diversity. Out-of-bag error as a free validation set.
codeconcept
30 min
2.4
Gradient boosting — concept → XGBoost → LightGBM
Boosting as sequential error correction, not averaging. How XGBoost and LightGBM differ from vanilla GBM. Practical tuning: n_estimators, learning_rate, max_depth — the three you must always set. When LightGBM beats XGBoost (and vice versa).
codemathlab
45 min
2.5
Feature importance — and its limitations
MDI (mean decrease impurity) importance and why it's biased toward high-cardinality features. Permutation importance as a correction. SHAP values for truly reliable explanations. What "importance" actually tells you and what it doesn't.
codeconcept
30 min
MOD 03
Support Vector Machines
The geometric elegance of maximum-margin classifiers — and when they're the right tool.
4 lessons

What you'll learn

  • The maximum-margin hyperplane idea
  • The kernel trick (properly, not hand-waved)
  • SVMs for regression (SVR)
  • When SVMs beat trees and vice versa

Tools used

  • sklearn SVC, SVR
  • RBF, polynomial kernels
  • GridSearchCV for C and gamma
3.1
The margin-maximization idea
Why maximum margin generalizes better than any separating hyperplane. Support vectors — the few points that determine everything. Hard vs soft margin (C parameter). Drawing the geometry by hand before touching code.
mathconcept
35 min
3.2
The kernel trick — explained without hand-waving
Why we need kernels: data that isn't linearly separable. The "feature space trick" — computing dot products in high-dimensional space without explicitly being there. RBF kernel, intuition of gamma. Polynomial kernels. When kernel SVMs are impractical (large N).
mathcode
40 min
3.3
SVMs for classification and regression
SVC for multi-class (one-vs-one strategy). SVR — the epsilon-insensitive tube. Probability calibration (SVM doesn't give probabilities natively, and what predict_proba actually does).
code
30 min
3.4
When to use SVMs vs trees vs linear models
A decision guide, not a vague suggestion. SVMs win on: small-to-medium datasets, high-dimensional sparse data (text), when you need a clean decision boundary. Trees win on: tabular data with mixed types, large N, interpretability requirements. Linear models win on: very large datasets, need for speed, regularized regression.
concept
20 min
MOD 04
Unsupervised Learning: Clustering
Finding structure in data without labels — the foundation of customer segmentation and anomaly detection.
5 lessons Project: customer segmentation

What you'll learn

  • K-Means algorithm step by step
  • Choosing K with the elbow method + silhouette
  • Hierarchical clustering (dendrograms)
  • DBSCAN for shape-agnostic clustering

Project deliverable

  • Segment e-commerce customers
  • Label clusters meaningfully (not just "cluster 2")
  • Visualize segments in 2D
  • Write a business recommendation per segment
4.1
K-Means: the algorithm, step by step
Initialize → assign → update → repeat. The Lloyd's algorithm, visualized at each step. Why initialization matters (K-Means++ vs random). Convergence and why K-Means can get stuck in local minima.
mathcode
35 min
4.2
Choosing K: elbow method and silhouette score
Inertia (WCSS) and the elbow — why the "elbow" is often ambiguous. Silhouette score as a more principled metric. Silhouette plots for diagnosing cluster quality. Combining both to make a defensible choice.
codeconcept
25 min
4.3
Hierarchical clustering
Agglomerative (bottom-up) vs divisive (top-down). Linkage methods: single, complete, average, Ward — and which one to pick. Reading dendrograms. When hierarchical clustering is better than K-Means (small N, unknown K, nested structure).
codeconcept
30 min
4.4
DBSCAN and density-based clustering
Why K-Means fails on non-convex shapes. Core points, border points, and noise (outliers). Epsilon and min_samples — what they control geometrically. DBSCAN vs K-Means: the shape test. When DBSCAN is the right tool (anomaly-adjacent clusters, unknown K, irregular shapes).
codeconcept
30 min
4.5
Project: customer segmentation
Full end-to-end: load an e-commerce dataset → clean → scale → cluster → evaluate → name and describe each segment → visualize with PCA → write one business recommendation per segment. Builds the vocabulary for real consulting work.
projectcode
90 min
MOD 05
Dimensionality Reduction
When you have too many features — compress them intelligently without losing what matters.
4 lessons

What you'll learn

  • Why high-dimensional data is a problem
  • PCA: variance, components, explained variance ratio
  • t-SNE and UMAP for visualization
  • When to reduce before modeling

Tools used

  • sklearn PCA, TruncatedSVD
  • sklearn TSNE
  • umap-learn
  • Plotly for interactive 2D/3D plots
5.1
The curse of dimensionality
Why distance metrics break in high dimensions. Sparsity in high-dimensional space. How many training samples you need as dimensions grow. The practical consequences for k-NN, SVMs, and any distance-based algorithm.
mathconcept
25 min
5.2
PCA: the math intuition and the code
Variance as information. Principal components as directions of maximum variance. Eigendecomposition of the covariance matrix — intuition first, then code. Explained variance ratio and the scree plot. Choosing n_components. Reconstructing original features. What PCA destroys (and why that's usually fine).
mathcodelab
45 min
5.3
t-SNE and UMAP for visualization
PCA is linear — t-SNE and UMAP are not. How t-SNE works (probability distributions over pairwise distances, KL divergence minimization). Why t-SNE results can be misleading (perplexity, random seed, cluster sizes don't mean what you think). UMAP: faster, more globally consistent, better for downstream tasks. When to use each.
codeconcept
35 min
5.4
When and why to reduce dimensions before modeling
The cases where PCA helps: multicollinearity, storage, speed. The cases where it hurts: tree-based models (already handle it), when features are interpretable and you need them to stay so. The wrong reason to use PCA (to avoid feature selection work). A decision checklist.
concept
20 min
MOD 06
Feature Engineering
The most underrated skill in ML. Better features beat better algorithms almost every time.
5 lessons 1 competition lab

What you'll learn

  • Creating features from raw data
  • All categorical encoding strategies
  • Text and datetime as ML features
  • Systematic feature selection

Why this module matters

  • Feature engineering wins Kaggle competitions
  • Domain knowledge becomes model input
  • No feature → no signal, however good the model
  • Taught too little in courses, used constantly in jobs
6.1
Creating features from raw data
Ratio features, interaction terms, polynomial features. Domain-driven features (e.g., "days since last purchase" from a timestamp, "price per square meter" from two columns). Binning continuous variables and when it helps. The craft of asking "what would a domain expert notice here?"
codeconcept
35 min
6.2
Handling categorical variables: encoding strategies
One-hot encoding — and why it explodes your feature space. Ordinal encoding — and when ordinality is actually meaningful. Target encoding — powerful and dangerous (why it causes leakage if done wrong). Frequency encoding. Hashing for high-cardinality. A decision tree for choosing the right encoding.
codeconcept
35 min
6.3
Handling text and dates as features
Text: bag of words, TF-IDF as a feature. Dates: extracting day-of-week, month, quarter, is_weekend, days_since_event. Why raw timestamps are useless to tree models. Lag features and rolling statistics for sequential data.
code
30 min
6.4
Feature selection methods
Filter methods: correlation, mutual information, chi-squared. Wrapper methods: recursive feature elimination (RFE). Embedded methods: L1 regularization, tree importance thresholding. SelectFromModel in scikit-learn. The right order: feature creation → selection (not selection → creation).
codeconcept
30 min
6.5
Lab: feature engineering on a Kaggle-style dataset
Start with a raw messy dataset (housing, Titanic, or retail — chosen for realism). Baseline model score with raw features. Then: engineer 8–10 new features, select the best, re-run model. Measure the score delta. Write a short analysis of which features moved the needle and why.
labcode
90 min
MOD 07
Model Evaluation & Tuning
A model is only as good as how you measure it. Evaluation done wrong costs companies money — done right, it builds trust.
4 lessons 1 lab

What you'll learn

  • Hyperparameter search strategies
  • Reading learning curves diagnostically
  • Handling imbalanced class distributions
  • Bayesian optimization intuition

Tools used

  • GridSearchCV, RandomizedSearchCV
  • Optuna (Bayesian optimization)
  • imbalanced-learn (SMOTE)
  • sklearn learning_curve utility
7.1
Hyperparameter tuning: grid search and random search
The difference between parameters (learned) and hyperparameters (set). Grid search — exhaustive but combinatorially expensive. Random search — why it often finds better solutions in fewer trials (Bergstra & Bengio, intuition without the paper). Running both inside a Pipeline (critical: tuning outside a pipeline leaks data). Reading GridSearchCV results.
codeconcept
35 min
7.2
Bayesian optimization — conceptual introduction
Why random search is still "dumb" — it doesn't learn from previous trials. Gaussian process surrogate model. Acquisition functions (expected improvement). Optuna as a practical implementation. When Bayesian optimization earns its overhead (expensive models, large search spaces).
codeconcept
30 min
7.3
Learning curves — diagnosing your model visually
Training score vs validation score as a function of training set size. Reading the four diagnostic patterns: underfit (both low), overfit (gap), just right (converging high), data-limited (high but would improve with more data). What to do for each. This is the most efficient debugging tool in supervised ML.
codeconcept
25 min
7.4
Handling imbalanced datasets
Why accuracy is the wrong metric for fraud detection (predicting all-negative is 99.9% accurate). SMOTE — synthetic minority oversampling, step by step. Class weights in sklearn (simpler than SMOTE, often good enough). Threshold tuning on the probability output. Precision-recall curves and PR-AUC as the right metrics. Common mistake: oversampling before cross-validation (data leakage).
codelab
40 min
MOD 08
Time Series Basics
Sequential data breaks most ML assumptions. Learn the adjustments that make models actually work on time-ordered data.
5 lessons Project: sales forecasting

What you'll learn

  • How time series data violates iid assumptions
  • Decomposition: trend, seasonality, residuals
  • ARIMA modeling end-to-end
  • Safe train/test splits for sequential data

Project deliverable

  • Forecast next 30 days of retail sales
  • Compare ARIMA vs LightGBM on same data
  • Plot confidence intervals on predictions
  • Explain results in plain language
8.1
What makes time series different from tabular data
The iid (independent, identically distributed) assumption — and how time series violates it. Autocorrelation: today's value depends on yesterday's. Stationarity — why most models need it and what it means. ACF and PACF plots for diagnosing structure in a series.
mathconcept
30 min
8.2
Trend, seasonality, and decomposition
Additive vs multiplicative decomposition. Classical decomposition in statsmodels. STL decomposition as a more robust alternative. Extracting and removing trend before modeling. Detecting seasonality visually and numerically. Why you care: residuals after decomposition are what your model actually learns from.
codeconcept
30 min
8.3
ARIMA models
AR (autoregressive) — predicting from past values. I (integrated) — differencing to achieve stationarity. MA (moving average) — modeling the error terms. Choosing p, d, q — using ACF/PACF and AIC. Fitting and forecasting with statsmodels. SARIMA for seasonal series. Auto-ARIMA (pmdarima) for when you don't want to pick manually.
mathcode
45 min
8.4
Train/test splitting for time series
Why random shuffling destroys time series evaluation (you'd be predicting the past from the future). Walk-forward validation (expanding window). Sliding window cross-validation. TimeSeriesSplit in scikit-learn. The minimum gap between train and test to avoid look-ahead leakage.
codeconcept
25 min
8.5
Project: sales forecasting
Full pipeline: load retail time series → EDA → decompose → make stationary → fit ARIMA → evaluate with MAE/RMSE → fit LightGBM with lag features as comparison → plot both forecasts with confidence intervals → write a one-page business summary of your predictions and uncertainty.
projectcode
120 min
MOD 09
Recommendation Systems
How Netflix, Spotify, and Amazon decide what to show you — and how to build a version yourself.
4 lessons Project: course/movie recommender

What you'll learn

  • Collaborative filtering (user-based & item-based)
  • Content-based filtering
  • Matrix factorization (SVD)
  • Hybrid approaches used in production

Project deliverable

  • Build a working movie or course recommender
  • Cold-start handling for new users
  • Evaluate with precision@K and recall@K
  • Expose as a simple FastAPI endpoint
9.1
Collaborative filtering
User-based CF: "users like you also liked…" — cosine similarity between user rating vectors. Item-based CF: "users who liked this also liked…" — more stable, scales better. The user-item matrix. Sparse matrix representations. Cold-start problem: what to do when a new user has no history. Memory-based vs model-based CF.
mathcode
40 min
9.2
Content-based filtering
Using item features (genre, tags, description) rather than user behavior. TF-IDF on item descriptions as feature vectors. Cosine similarity between items. Building a user profile from their liked items. Strengths: no cold-start for items, explainable. Weaknesses: filter bubble, ignores collective intelligence.
codeconcept
30 min
9.3
Hybrid approaches and matrix factorization
SVD (singular value decomposition) for latent factor models — decomposing the user-item matrix into user and item embeddings. Surprise library for implementing SVD-based recommenders. Hybrid: content + collaborative (how real systems work). Evaluation: precision@K, recall@K, NDCG. The offline vs online evaluation distinction.
mathcode
40 min
9.4
Project: build a movie or course recommender
Choose a dataset (MovieLens or a course dataset). Implement both user-based CF and content-based. Combine into a hybrid. Handle cold-start with popularity fallback. Evaluate with precision@K. Wrap the recommendation function in a simple FastAPI endpoint. Write a brief analysis of where each approach fails.
projectcode
120 min
MOD 10
Capstone: End-to-End ML Project
Pull everything together. Frame a business problem, build a full pipeline, deploy it, and explain it to someone who doesn't know what a gradient is.
Tier 2 Capstone 4 lessons

What you'll build

  • A full ML solution to a real business question
  • Clean, reproducible pipeline (not a notebook mess)
  • A FastAPI endpoint serving predictions
  • A non-technical presentation of results

What this demonstrates

  • End-to-end ML project ownership
  • Business problem → ML framing ability
  • Production-minded coding habits
  • Communication to non-technical stakeholders
10.1
Problem framing — translating a business question into an ML task
The most important skill that courses skip. "We want to reduce churn" → what is the prediction task? What's the label? What's the positive class? What's the cost of a false positive vs false negative? What data do we have, and when? Worked examples: fraud detection, churn prediction, demand forecasting. A framing template you can reuse on any project.
concept
35 min
10.2
Full pipeline: EDA → feature engineering → modeling → evaluation
Structured approach to each stage. EDA checklist (distributions, missing values, correlations, outliers). Feature engineering from domain knowledge. Model selection with cross-validation — no peeking at test set. Evaluation with the right metric for the business problem. Comparing at least 3 algorithms and justifying your final choice.
codelab
120 min
10.3
Model deployment basics — a FastAPI prediction endpoint
Load a saved joblib Pipeline. Build a POST /predict endpoint that accepts JSON, runs the pipeline, returns a prediction with probability. Input validation with Pydantic. A simple health check endpoint. Testing with curl and the FastAPI docs page. This is the minimum viable deployment that demonstrates "I can ship this."
codeproduction
45 min
10.4
Presenting results to a non-technical audience
The difference between an ML evaluation report and a business recommendation. Translating RMSE into business impact ("this means our forecasts are off by ±$12k per week on average"). Visualizations that work for executives (not ROC curves). Confidence and uncertainty — how to say "I'm not sure" honestly without losing credibility. Template for a 5-slide results deck.
communication
30 min

// Tier 2 complete

You can now build, evaluate, and deploy classical ML models across the problem types that run most of real-world production ML. You're ready for Tier 3 — Deep Learning & Neural Networks — where everything gets rebuilt from first principles using PyTorch.

NEXT →
Tier 3
Deep Learning & Neural Networks. 12 modules. Build from NumPy → PyTorch → CNNs → Transformers.
OR →
Stop here
Tier 2 alone qualifies you for many ML Engineer and Data Scientist roles. The capstone project is portfolio-ready.
BUILD →
Portfolio projects
Customer segmentation system. Sales forecasting API. Movie recommender. All three are Upwork-ready deliverables.
EARN →
Certificate
Complete all 10 modules and the capstone to unlock your Tier 2 certificate from BitWithBite.