Machine Learning#

Classical machine learning — from linear regression to production pipelines. The mathematics, algorithms, and engineering practices that underpin every ML system, before deep learning enters the picture.

Overview#

Machine learning is the discipline of building systems that learn patterns from data rather than being explicitly programmed. This path covers classical (non-deep-learning) ML: the algorithms, evaluation techniques, and engineering workflows that remain the backbone of most production ML systems today.

Despite the hype around deep learning, the majority of real-world ML in production — fraud detection, recommendation engines, pricing models, churn prediction, demand forecasting — runs on gradient-boosted trees, logistic regression, and well-engineered feature pipelines. Understanding these foundations is not optional.

This path uses Python throughout, with scikit-learn as the primary framework, supplemented by pandas, NumPy, and matplotlib. Every concept is paired with working code.

Prerequisites#

  • Comfortable with Python (functions, classes, list comprehensions)
  • Basic familiarity with NumPy and pandas
  • High-school level statistics (mean, standard deviation, probability)
  • Linear algebra basics helpful but not required (covered where needed)

Sections#

#SectionTopics
1Introduction to Machine LearningSupervised, unsupervised, reinforcement learning, bias-variance tradeoff, overfitting, ML workflow
2Data PreparationFeature engineering, missing data, categorical encoding, scaling, train/validation/test splits
3Linear ModelsLinear regression, logistic regression, gradient descent, regularisation (L1/L2/ElasticNet)
4Decision Trees & EnsemblesDecision trees, random forests, gradient boosting, XGBoost, LightGBM, CatBoost
5Support Vector MachinesLinear SVM, kernel trick, RBF/polynomial kernels, soft margin, SVR
6Unsupervised LearningK-means, DBSCAN, hierarchical clustering, PCA, t-SNE, UMAP, anomaly detection
7Model EvaluationAccuracy, precision, recall, F1, ROC-AUC, confusion matrix, cross-validation, learning curves
8Hyperparameter TuningGrid search, random search, Bayesian optimisation, Optuna, early stopping
9Feature Selection & EngineeringFilter/wrapper/embedded methods, mutual information, permutation importance, target encoding
10Time SeriesStationarity, ARIMA, seasonal decomposition, lag features, Prophet, time series CV
11ML Pipelines & scikit-learnPipeline, ColumnTransformer, custom transformers, serialisation, reproducibility
12MLOps & DeploymentMLflow, experiment tracking, model versioning, serving, monitoring, data drift

Algorithm Quick Reference#

AlgorithmTypeBest ForInterpretable?
Linear RegressionSupervised (regression)Continuous targets, linear relationships✅ High
Logistic RegressionSupervised (classification)Binary/multiclass, baseline models✅ High
Decision TreeSupervised (both)Explainable models, feature discovery✅ High
Random ForestSupervised (both)General-purpose, robust to noise⚠️ Medium
Gradient BoostingSupervised (both)Tabular data competitions, high accuracy⚠️ Medium
SVMSupervised (both)High-dimensional data, small datasets❌ Low
K-MeansUnsupervised (clustering)Customer segmentation, data exploration✅ High
DBSCANUnsupervised (clustering)Arbitrary-shape clusters, outlier detection⚠️ Medium
PCAUnsupervised (dim. reduction)Visualisation, noise reduction, compression⚠️ Medium
Isolation ForestUnsupervised (anomaly)Fraud detection, outlier identification⚠️ Medium

Python Environment Setup#

# Create a virtual environment
python -m venv ml-env
source ml-env/bin/activate

# Install core dependencies
pip install scikit-learn pandas numpy matplotlib seaborn jupyter

# Optional but recommended
pip install xgboost lightgbm catboost optuna mlflow

Follow the sections in order — each builds on the previous:

Introduction → Data Preparation → Linear Models → Trees & Ensembles
→ SVM → Unsupervised → Evaluation → Tuning → Feature Engineering
→ Time Series → Pipelines → MLOps

Sections 7–9 (Evaluation, Tuning, Feature Engineering) are cross-cutting and apply to every algorithm covered earlier.