AWS Builder Center
Regression vs Classification

Regression vs Classification

Get familiar with the two main types of supervised learning tasks, the difference between them, and when to apply regression and classification.

Series: Attention because it's all you need. (8 articles)

  1. …
  2. 7
    Regression vs Classification This article
Machine Learning Engineer | Frontend Developer | Deep Learning & Generative AI | RAG, MLOps & AWS

Regression vs Classification in Machine Learning

As we start learning machine learning, we immediately come across the basics of supervised learning. Namely, two types of tasks: regression and classification. Both learn from labeled data but solve different tasks. Knowing the difference between these two is one of the things we need to know in order to dive further into Machine Learning models.

What Is Regression?

Regression is used to predict continuous numerical values. So, let's say, we want to predict the price of a house depending on certain features such as size, location, number of rooms and other parameters. Our output can be 12 million dollars, 15.5 million dollars or any other numerical value. Examples of other regressions are weather prediction, salary prediction, sales prediction, demand prediction and many more. In other words, regression predicts continuous numerical values. Examples of regression algorithms are linear regression, polynomial regression, decision tree regression, random forest regression and support vector regression.

What Is Classification?

Classification is used to predict output which belong to some class or category. Let's say, now we want to predict whether our email is spam or not spam, for example. Our outputs are categories, not some arbitrary continuous numerical values. Classification can consist of two classes, such as spam / not spam, or can consist of several classes, such as classifying an image as a cat, dog, bird or horse. Examples of classification algorithms are logistic regression, decision trees, random forests, support vector machines, k-nearest neighbors, naive bayes.

What Is the Major Difference?

The most straightforward way to see the difference between these two types of models is to see what kind of output does the model predict. Regression predicts continuous numerical values, whereas classification predicts categories or classes. For example, predicting someone's exact price of a house is a regression task, but predicting whether the house belongs to a specific price range can be a classification task. It should be noted that the difference is not in the algorithm used, because there are algorithms, like decision trees and random forests, which can be used for both classification and regression. The difference lies in the learning task and the target variable.

How Do We Know Which One to Use?

We just have to answer the question: "What exactly do I want to predict?"**** And depending on the answer, either we deal with regression or classification. Now we know one of the fundamentals of supervised Machine Learning. Next, we should move on to understanding the way these models work.

Series: Attention because it's all you need. (8 articles)

  1. …
  2. 7
    Regression vs Classification This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article