Module 4: Classification by Logistic Regression

What this module covers

This module moves from numerical regression (predicting continuous values) to classification (predicting discrete categories). Think of classifying images as a cat or dog, or classifying each pixel in a satellite image as different land-cover types.

You’ll learn how logistic regression — despite its name — is a classification scheme that uses the sigmoid (logistic) function as its loss function. The surprising and powerful insight is that the ML algorithms you already know (batch gradient descent, stochastic gradient descent, mini-batch gradient descent) generalize in a straightforward way to classification. The only modification needed is a different loss function; the optimization machinery stays the same.

In the practice exercise, you’ll see how this relatively simple model can accomplish impressively complex tasks — including building your own handwriting recognition system.

Materials

Slides: Logistic Regression & Classification (pdf)

Lecture: Logistic Regression for Classification — from binary classification to multiclass problems, with interactive code and visualizations.

Practice: Logistic Regression — hands-on exercise applying classification to real problems, including handwriting digit recognition.

Data files

  • binary_classification_1 - Sheet1.csv — a simple binary classification dataset
  • hand_writing_dataset.txt — the MNIST-style handwriting digit dataset

Prerequisites

Module 3 — multivariate regression and gradient descent with multiple features.


Next module: Module 5: Data Preprocessing & Pipelines — the crucial steps that come before modeling.