Quest 2 of 15
Classical Machine Learning
Implement and use classical ML: linear and logistic regression, train/validation/test splits, overfitting, and metrics (accuracy, precision, recall, RMSE). You will build a classifier with scikit-learn and inspect coefficients or feature importances. For example, you will train on 80% of a tabular dataset, tune a simple hyperparameter on validation data, and report final metrics on a held-out test set only once.
Start here
Neural networks receive most of the attention, but structured business data is often best served by interpretable baselines, trees, and ensemble methods. This module builds an honest scikit-learn workflow before adding complexity.
Big idea
A useful classical machine-learning system is more than model.fit(). You must define the prediction unit, split data without leaking future information, establish a simple baseline, preprocess consistently, choose metrics that reflect the cost of errors, and preserve a final test set for an unbiased estimate.

Learn one idea at a time
Read, explore, then mark each idea when you can explain it.
Idea 1 of 10
Frame each row and target before splitting. In a fraud classifier, one row might be a card transaction and the target records whether investigators later confirmed fraud. Features available only after investigation must not appear in training because the live system will not have them when it predicts.
Choose a deep dive
Open the topics you want to explore. The detail stays folded until you need it.
Deep dive 1Worked example: an imbalanced fraud pipeline
A team builds a Pipeline with median imputation, one-hot encoding, and logistic regression. It trains on six months of transactions and validates on month seven. At the default threshold, recall is high but too many legitimate cards are blocked. The team raises the threshold, measures expected fraud loss against customer disruption, and sends medium-risk cases to analysts rather than forcing a binary automated decision. Month eight remains untouched until the design is final.
Deep dive 2Leakage can create impossible performance
Imagine using a chargeback date to predict whether the original payment was fraudulent. The model may score brilliantly because the feature reveals the future outcome, but that date does not exist when a live payment arrives. Leakage can also be subtle: target-encoding categories before splitting, scaling on the full dataset, or allowing duplicate customers into train and test. Review every feature by asking when and how it becomes available.
Deep dive 3Baselines are mandatory
Predict the majority class or the mean target — your model must beat this on validation before it is interesting.
Deep dive 4Regularisation fights overfitting
L2 penalises large weights; early stopping halts training when validation worsens. Both are cheap wins before bigger architectures.
Deep dive 5Worked example: a leakage bug you will actually write
Tempting code: scaler.fit_transform(X) on the full dataset, then train_test_split. The scaler has now seen the test rows' means and variances — information from the future leaked into training. Correct order: split first, then Pipeline([('scaler', StandardScaler()), ('clf', LogisticRegression())]) and fit only on the training partition; the pipeline applies the training-set statistics to validation and test automatically. The same trap appears with target encoding, imputation, feature selection, and oversampling — any transform fitted before the split. The symptom is a validation score that mysteriously drops in production; the vaccine is putting every fitted transform inside the pipeline, always.
Deep dive 6Trees, forests, and boosting in one paragraph
A decision tree asks a sequence of feature questions and is fully interpretable but high-variance: small data changes reshape it. A random forest trains many trees on bootstrapped samples with random feature subsets and averages them — variance drops, accuracy rises, interpretability blurs. Gradient boosting builds trees sequentially, each correcting its predecessors' residual errors; tuned well (XGBoost, LightGBM), it remains the strongest family on most tabular business data and typically beats neural networks there. A sensible default ladder: logistic or linear baseline, then a random forest for a quick strong reference, then boosting when you need the last points of performance.
Deep dive 7Metrics match the problem
Fraud and disease screening need recall — not accuracy alone.

One-minute challenge
Connect this lesson to real life
Name one situation where this idea could help, and one thing a person should still check.
Explore a real-world example
Use the arrows to connect the idea to a visible situation.
Photo example
Example: confusion matrix
Count FP and FN costs before picking a threshold.

Key terms
Tap a term to flip and read the definition.
Optional further learningFree textbooks and trusted online resources
These sources informed the course structure. Use them to revisit a concept or study it in more depth.
Ready check
Tick each idea only when you could explain it without looking back.
Ready for practice? Train a sklearn pipeline on the provided tabular dataset.
Extra context (audience, logistics, curriculum notes)
Built for: Continues from Module 1; assumes NumPy comfort.
Formats: scikit-learn labs · Metric interpretation · Scenario quiz · Code review checklist
Developer track Module 2 — scikit-learn, evaluation, and model selection.
Next up
Ready for the next part?
When you've finished the reading, inline exercises, and knowledge check for this part, check the box to continue.