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

ROC, AUC and imbalanced classes

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

Rates at every threshold, AUC and class weights.

What you'll learn in this lesson

  • Read a ROC curve and explain what AUC measures.
  • Compute true and false positive rates at a threshold.
  • Handle imbalanced classes with class_weight.

Overview

A threshold gives one point on the precision-recall trade-off. But what if you want to compare two models before choosing a threshold? The ROC curve plots, for every possible threshold:

A perfect model hugs the top-left corner. A model guessing at random follows the diagonal. The AUC (area under the curve) summarises it: 1.0 is perfect and 0.5 is random guessing. It has a nice meaning: the probability that a randomly chosen positive gets a higher score than a randomly chosen negative.

Sections covered in this lesson

  1. 1The hook: one number for every threshold
  2. 2Comparing ranking & imbalance metrics
  3. 3Imbalanced classes
  4. 4Progressive examples: ROC curves, AUC, and class weights
  5. 5Practice
  6. 6Check your understanding
Pro Lesson · Module 5 — Classification

Unlock "ROC, AUC and imbalanced classes" and the full Machine Learning: from first principles to practice curriculum

Rates at every threshold, AUC and class weights.

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.