Skip to main content
Module 5 · Lesson 1 of 621/56 in the course~22 min
Module lessons (1/6)

Logistic regression

Lesson preview5 hands-on exercises readyMachine Learning: from first principles to practice · Module 5 — Classification

The sigmoid, probabilities, thresholds and linear decision boundaries.

What you'll learn in this lesson

  • Explain how logistic regression turns a score into a probability with the sigmoid.
  • Train a classifier, read its probabilities and change the decision threshold.
  • Describe the decision boundary of a linear classifier.

Overview

Linear regression outputs any number. For classification we want a probability between 0 and 1: "how likely is this tumour to be malignant?". Logistic regression computes a linear score exactly as before and then squeezes it through the sigmoid function:

Large positive scores give probabilities near 1, large negative scores near 0, and a score of 0 gives exactly 0.5. To get a class, we compare the probability with a threshold, 0.5 by default.

Sections covered in this lesson

  1. 1The hook: from a number to a probability
  2. 2Try it: boundary lab
  3. 3Linear regression vs. logistic regression
  4. 4Progressive examples: from logits to thresholds
  5. 5Practice
  6. 6Check your understanding
Pro Lesson · Module 5 — Classification

Unlock "Logistic regression" and the full Machine Learning: from first principles to practice curriculum

The sigmoid, probabilities, thresholds and linear decision boundaries.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Machine Learning: from first principles to practice plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.