Machine Learning

Overview

About Machine Learning

Machine learning is the craft of getting a program to learn patterns from data instead of following hand-written rules. It is the base layer under everything that comes later in this course: neural networks, Transformers, and LLMs all reuse the same ideas of training, validation, and generalization that you meet here.

You'll start with the ML workflow and the scikit-learn API, then build your first models: linear regression for numbers and logistic regression for categories. Before going further, you'll learn how to measure a model honestly with the right metrics, proper data splits, and cross-validation, and how to recognize and fight overfitting.

From there you'll work through the models that still win on tabular data: decision trees, random forests, gradient boosting, plus k-NN, SVMs, and Naive Bayes. You'll learn to build features and pipelines that don't leak information, explore unlabeled data with clustering and PCA, and finish with hyperparameter tuning, model interpretation, and the pitfalls that quietly break real projects.

Every lesson pairs the intuition with working scikit-learn code, so you can see why an algorithm behaves the way it does, not just how to call it.

Lessons

12 lessons
01

The ML Workflow

Supervised vs. unsupervised learning, the end-to-end workflow from problem framing to prediction, and the fit / predict / score pattern shared by every scikit-learn estimator.

Supervised Unsupervised scikit-learn fit / predict
02

Linear Regression

Predicting continuous values: least squares, the cost function, gradient descent, multiple features, polynomial terms, and reading coefficients.

Least Squares Gradient Descent Polynomial Features
03

Logistic Regression & Classification

Turning scores into probabilities with the sigmoid, decision boundaries, thresholds, and extending binary classifiers to multiple classes.

Logistic Regression Sigmoid Decision Boundary Softmax
04

Evaluation Metrics

Choosing the metric that matches the real-world cost: MSE and MAE for regression, and accuracy, precision, recall, F1, ROC-AUC, and confusion matrices for classification.

Precision / Recall F1 ROC-AUC RMSE
05

Data Splitting & Cross-validation

Train, validation, and test sets; k-fold and stratified splits; time-series splits; and why you must never touch the test set until the very end.

Train / Test Split k-Fold Stratified Time-Series Split
06

Overfitting & Regularization

The bias-variance trade-off, learning curves, and how L1 / L2 regularization (Ridge, Lasso, Elastic Net) keep models from memorizing noise.

Bias-Variance Ridge Lasso Learning Curves
07

Decision Trees

How trees split data with Gini impurity and entropy, why they overfit so easily, and how depth limits and pruning control them.

Gini Entropy Pruning Feature Importance
08

Ensembles: Forests & Boosting

Combining many weak models into a strong one: bagging and random forests, then gradient boosting with XGBoost and LightGBM, the workhorses of tabular data.

Random Forest Bagging Gradient Boosting XGBoost
09

k-NN, SVM & Naive Bayes

Three classic algorithms and when each one shines: distance-based prediction, maximum-margin classifiers with kernels, and fast probabilistic baselines for text.

k-NN SVM Kernels Naive Bayes
10

Feature Engineering & Pipelines

Scaling, encoding categories, handling missing values, and creating new features, all wrapped in scikit-learn Pipelines and ColumnTransformers so preprocessing never leaks.

Scaling One-Hot Encoding Pipeline ColumnTransformer
11

Clustering & PCA

Finding structure without labels: k-means and hierarchical clustering, DBSCAN for odd shapes, and dimensionality reduction with PCA for compression and visualization.

k-Means DBSCAN PCA Silhouette Score
12

Tuning, Interpretation & Pitfalls

Grid, random, and Bayesian hyperparameter search; explaining predictions with permutation importance and SHAP; and avoiding data leakage, class imbalance, and distribution shift.

GridSearchCV Optuna SHAP Data Leakage

What You Can Do After This Module

By the end of the module you'll be able to take a tabular dataset from raw columns to a validated, explainable model. Concretely, you'll be able to:

Frame a problem correctly — decide between regression, classification, and clustering, and pick a metric that reflects the real cost of mistakes.

Validate honestly — split data, run cross-validation, and keep a test set untouched so your numbers can be trusted.

Diagnose overfitting — read learning curves and apply regularization, depth limits, or ensembling to fix it.

Train strong baselines — use linear models, random forests, and gradient boosting, and know when each is the right tool.

Build leak-free pipelines — chain preprocessing and models so training and production behave identically.

Explain and tune your models — search hyperparameters efficiently and justify predictions to teammates and stakeholders.