Course contentsShow
← Computer Science
Lesson 2781 of 2,87262. Machine Learning FundamentalsFree lesson

Classification vs Regression Problems

Distinguishing between predicting discrete categories (classification) and continuous values (regression).

Classification vs Regression Problems

What you'll learn: How to distinguish between predicting categories versus predicting numbers in machine learning.

The Core Distinction

In machine learning, supervised learning tasks split into two fundamental types based on what you're predicting:

Classification problems predict discrete categories or labels. Your output is one of a finite set of classes. Think: "Is this email spam or not spam?" or "Which digit (0-9) is handwritten in this image?" The label isn't a number you calculate—it's a category you assign.

Regression problems predict continuous numerical values. Your output can be any number within a range. Think: "What will this house sell for?" or "How many inches of rain will fall tomorrow?" The label is a real number you estimate.

Why It Matters

The distinction affects everything downstream:

  • Your loss function: Classification typically uses cross-entropy or hinge loss; regression uses mean squared error or mean absolute error
  • Output format: Classification outputs probabilities or class labels; regression outputs a single number or vector of numbers
  • Evaluation metrics: Classification uses accuracy, precision, recall; regression uses RMSE, MAE, R²

The Subtle Cases

Some problems blur the line. Predicting "low/medium/high" temperature is ordinal classification—categories with an order. Predicting a probability (0.0 to 1.0) looks continuous but might feed a classification decision.

The key test: Could your output be any value in a range, or must it be one of specific buckets?

Key Takeaway: Classification predicts which category something belongs to (discrete labels), while regression predicts a numerical value (continuous output)—this distinction fundamentally shapes your choice of loss function, evaluation metrics, and model architecture.