Regression is a supervised machine learning task used to predict a numerical value.
Examples include:
- House price → $385,000
- Delivery time → 34 minutes
- Weekly sales → 1,250 units
- Electricity usage → 420 kWh
- Revenue → $48,500
The easiest way to remember the difference between classification and regression is:
Classification = Which category?
Regression = How much?
For example:
Spam or Not Spam → Classification
How much will this house sell for? → Regression
Regression models learn relationships between input features and numerical targets, then use those relationships to estimate values for new, unseen data.
What Is Regression in Machine Learning?
Regression in machine learning is a supervised learning approach used when the value we want to predict is numerical.
Imagine a property website wants to estimate the price of a house.
It has historical information about previously sold homes.
For each house, it might know:
- size
- number of bedrooms
- number of bathrooms
- location
- property age
- actual selling price
The model studies the relationship between those features and previous sale prices.
Later, we provide information about a new house.
The model might predict:
Estimated Price: $385,000
That is a regression prediction.
The answer is not simply:
Cheap
or:
Expensive
Those are categories.
Regression predicts an actual numerical quantity.
Why Do We Need Regression?
Many real-world questions require more than a category.
Imagine asking:
How much will this house sell for?
The answer:
Expensive
is not very useful.
A numerical estimate such as:
$385,000
is much more practical.
Similarly, a delivery company may want to know:
How long will this delivery take?
Instead of:
Fast
the model may predict:
34 minutes
Regression is useful when the desired output is an amount, quantity, measurement, or numerical estimate.
Real-Life Regression Examples
| Problem | Possible Prediction |
|---|---|
| House-price estimation | $385,000 |
| Delivery-time prediction | 34 minutes |
| Sales forecasting | 1,250 units |
| Electricity-use prediction | 420 kWh |
| Product demand | 760 units |
| Revenue forecasting | $48,500 |
All of these have one thing in common:
The target is numerical.
A Simple Everyday Analogy
Imagine your friend asks:
“How much do you think this used laptop will sell for?”
You might consider:
- brand
- age
- condition
- storage
- specifications
- prices of similar laptops
Then you estimate:
“Probably around $450.”
A regression model follows a similar basic idea.
It uses available features, learns relationships from historical examples, and estimates a numerical value for a new example.
The model does this mathematically rather than thinking like a human.
Regression Is Supervised Learning
Regression belongs to supervised learning.
Why?
Because the model learns from examples where the correct historical outcomes are already known.
Suppose we have this dataset:
| House Size | Bedrooms | Age | Actual Price |
|---|---|---|---|
| 1,400 sq. ft. | 2 | 12 years | $215,000 |
| 1,800 sq. ft. | 3 | 8 years | $290,000 |
| 2,200 sq. ft. | 3 | 5 years | $355,000 |
| 2,700 sq. ft. | 4 | 3 years | $445,000 |
The model sees both:
Input features
and:
Known numerical target
The known target helps guide the learning process.
Features and Targets in Regression
Two terms are especially important:
Features
and:
Target
What Are Features?
Features are the pieces of information used to make a prediction.
For house-price prediction, features might include:
- size
- bedrooms
- bathrooms
- location
- property age
- lot size
Memory Rule
Features = Clues
What Is the Target?
The target is the numerical value we want the model to predict.
Examples:
House-price model
Target = House price
Delivery model
Target = Delivery time
Sales model
Target = Number of sales
Memory Rule
Target = Number we want to predict
Features vs Target: Simple Examples
| Problem | Features | Target |
|---|---|---|
| House price | Size, rooms, location, age | Price |
| Delivery time | Distance, traffic, time | Minutes |
| Sales prediction | Previous sales, promotion, season | Sales amount |
| Electricity usage | Weather, time, previous usage | Energy used |
Once the target is identified, it becomes much easier to recognize whether the problem is regression.
How Does Regression Work?
For beginners, regression can be understood in six steps:
- Collect historical data
- Identify features and the numerical target
- Train a regression model
- Compare predictions with actual values
- Adjust the model to reduce error
- Predict values for new data
Step 1: Collect Historical Data
Regression begins with examples.
Suppose we want to predict house prices.
We collect historical sales data:
| Size | Bedrooms | Age | Sold Price |
|---|---|---|---|
| 1,500 sq. ft. | 2 | 10 years | $225,000 |
| 1,900 sq. ft. | 3 | 7 years | $310,000 |
| 2,300 sq. ft. | 3 | 5 years | $370,000 |
| 2,900 sq. ft. | 4 | 2 years | $485,000 |
The model learns from relationships inside these examples.
The quality and relevance of the data matter because the model can only learn from the information it receives.
Step 2: Identify Features and Target
For our house-price example:
Features
- house size
- bedrooms
- age
- location
Target
House price
The model's job is:
Learn how the features relate to the numerical target.
Step 3: Train the Regression Model
At the beginning, the model does not know the correct relationship.
Suppose a house actually sold for:
$350,000
but the model predicts:
$300,000
The prediction is wrong by:
$50,000
During training, the system measures prediction errors and adjusts the model according to its learning method.
A simplified flow is:
Features → Prediction → Compare With Actual Value → Measure Error → Adjust Model → Repeat
Training continues across many examples.
What Does a Regression Model Learn?
A regression model tries to learn relationships between features and a numerical target.
Imagine we use only:
House Size
to predict:
House Price
We may see:
- 1,000 sq. ft. → $180,000
- 1,500 sq. ft. → $240,000
- 2,000 sq. ft. → $310,000
- 2,500 sq. ft. → $375,000
There appears to be a general relationship:
Larger houses tend to cost more.
A regression model tries to represent that relationship mathematically.
Real-world problems usually involve more features, but this simplified example makes the concept easier to understand.
Does Regression Memorize Previous Values?
A useful regression model should not simply memorize training examples.
Suppose the training data contains:
- 2,000 sq. ft.
- 2,500 sq. ft.
Now we give the model a new house:
2,250 sq. ft.
The exact house may never have appeared in the training data.
The model should use what it learned to produce a useful estimate.
For example:
Predicted Price: $342,000
The ability to work well on new data is called:
Generalization
Step 4: Compare Prediction With the Actual Value
Regression models are evaluated by comparing:
Predicted value
with:
Actual value
Example:
Actual price:
$400,000
Prediction:
$385,000
Difference:
$15,000
Another house:
Actual:
$300,000
Prediction:
$330,000
Difference:
$30,000
These differences help us measure model performance.
What Is Error in Regression?
Regression error is the difference between the model's prediction and the actual value.
Example:
Actual delivery time:
40 minutes
Prediction:
35 minutes
The model missed by:
5 minutes
However, a model should not be judged using only one prediction.
Performance is measured across many examples.
Common regression metrics include:
- MAE
- MSE
- RMSE
- R²
These will be covered in more detail in a dedicated evaluation guide.
Step 5: Improve the Model
During training, the model tries to reduce its prediction error.
Different algorithms do this in different ways.
For simple linear models, parameters may be adjusted so predictions better match the observed target values.
A beginner-friendly way to remember the process is:
Prediction → Error → Adjustment → Improved Prediction
You do not need the mathematics yet.
Step 6: Predict New Values
Once the model has been trained and evaluated, it can be used on new data.
Suppose a new house has:
- Size: 2,400 sq. ft.
- Bedrooms: 4
- Age: 4 years
- Location: Area B
The model might predict:
Estimated Price: $410,000
Using a trained model to generate predictions on new inputs is called:
Inference
The Complete Regression Workflow
A simple regression workflow is:
Historical Data
↓
Features + Numerical Target
↓
Train Regression Model
↓
Learn Relationships
↓
Evaluate Errors
↓
New Input
↓
Predict Numerical Value
For a house-price example:
Previously Sold Houses
↓
Size + Bedrooms + Location + Price
↓
Train Model
↓
New House
↓
Predicted Price: $410,000
That is regression in machine learning.
Regression vs Classification
This difference is fundamental.
| Classification | Regression |
|---|---|
| Predicts a category | Predicts a numerical value |
| Spam / Not Spam | Delivery time |
| Cat / Dog | House price |
| Fraud / Legitimate | Sales amount |
| “Which one?” | “How much?” |
Example 1
Question:
Will this house sell within 30 days?
Output:
Yes / No
This is:
Classification
Example 2
Question:
What price will this house sell for?
Output:
$410,000
This is:
Regression
The input data may be similar, but the target is different.
A Number Does Not Always Mean Regression
This is a common beginner mistake.
Suppose:
0 = Not Spam
1 = Spam
The outputs are written as numbers.
But those numbers represent categories.
So the problem is still:
Classification
Regression predicts a numerical quantity where the numerical difference has real meaning.
Examples:
- $250,000 vs $350,000
- 20 minutes vs 45 minutes
- 500 units vs 800 units
So do not ask:
“Is the output written as a number?”
Ask:
“Does the output represent a real numerical quantity?”
Is Logistic Regression Actually Regression?
Despite its name, Logistic Regression is commonly used for classification.
A simple memory rule is:
Linear Regression → Numerical prediction
Logistic Regression → Classification probability
This naming can confuse beginners, but the two methods serve different primary purposes.
What Is Linear Regression?
Linear Regression is one of the most important regression methods.
It models the relationship between one or more input features and a numerical target using a linear relationship.
Imagine plotting:
House Size
against:
House Price
If larger houses generally cost more, the data may show an upward trend.
Linear Regression tries to fit a line that represents that overall relationship.
This method deserves its own complete guide, so here we only need the basic idea.
Simple vs Multiple Regression
Regression models can use one or many features.
Simple Regression
Use one feature:
House Size → House Price
Multiple Regression
Use several features:
Size + Bedrooms + Bathrooms + Age + Location → House Price
Real-world predictions often use multiple relevant features.
Real-Life Regression Example: Delivery Time
Suppose a delivery company wants to predict delivery duration.
Features may include:
- distance
- traffic conditions
- time of day
- previous delivery duration
Target:
Delivery Time
Prediction:
38 minutes
That is regression.
Real-Life Regression Example: Sales Forecasting
An online store wants to predict how many units it may sell next week.
Features might include:
- previous sales
- price
- promotion
- season
- day of week
- website traffic
Target:
Units Sold
Prediction:
1,240 units
Again:
Numerical target → Regression
Real-Life Regression Example: Energy Usage
A building-management system may predict electricity consumption.
Features:
- temperature
- time
- day of week
- previous energy usage
- building activity
Prediction:
420 kWh
The business problem changes, but the regression idea stays the same.
Common Regression Algorithms
Regression is the problem type.
Many algorithms can solve regression problems.
Examples include:
- Linear Regression
- Ridge Regression
- Lasso Regression
- Decision Tree Regression
- Random Forest Regression
- KNN Regression
- Support Vector Regression
- Neural Networks
You do not need to learn all of them yet.
At this stage, focus on understanding:
What regression predicts
and:
How regression works
Regression Problem vs Regression Algorithm
This distinction is important.
Regression Problem
The task:
Predict a numerical value
Example:
House price
Regression Algorithm
The method used to solve the problem.
Example:
Linear Regression
So:
Regression = prediction task
Linear Regression = one method
Can Regression Predictions Be Wrong?
Yes.
Suppose a model predicts:
$410,000
but the actual selling price is:
$455,000
The model is off by:
$45,000
Regression predictions are estimates based on learned patterns.
They are not guaranteed facts.
A model may perform poorly because:
- training data is limited
- important features are missing
- data contains errors
- patterns are more complex than the model can represent
- the world has changed
- the new example differs greatly from training data
That is why models must be evaluated on unseen data.
Does Correlation Mean Causation?
No.
A regression model may discover useful statistical relationships.
But a relationship between two variables does not automatically prove that one causes the other.
A useful rule is:
A relationship may help prediction without proving cause and effect.
This is especially important when regression is used for interpretation rather than prediction alone.
Common Beginner Mistakes
Mistake 1: Thinking Regression Means “Going Backward”
In machine learning, regression refers to modeling numerical relationships and predicting numerical values.
Mistake 2: Thinking Every Number Means Regression
Category codes such as:
0 = Cat
1 = Dog
still represent classification.
Mistake 3: Confusing Regression With Linear Regression
Regression is the broad prediction task.
Linear Regression is one method.
Mistake 4: Thinking Logistic Regression Predicts Continuous Values
Despite its name, Logistic Regression is commonly used for classification.
Mistake 5: Assuming Regression Predictions Are Exact
Predictions are estimates.
Evaluation tells us how large the errors are.
Mistake 6: Choosing the Algorithm Before Defining the Target
Do not begin with:
“I want to use Linear Regression.”
Begin with:
“What exactly am I trying to predict?”
If the target is a numerical quantity, regression may be appropriate.
Then choose the regression algorithm.
Why Regression Is Important
Regression is important because many real-world decisions depend on numerical estimates.
Examples include:
- prices
- demand
- delivery time
- revenue
- energy use
- quantities
But useful regression requires more than fitting a model.
You also need:
- relevant data
- useful features
- reliable targets
- proper training
- unseen evaluation data
- suitable error metrics
Regression in One Simple Flow
Remember:
Historical Data
↓
Features + Numerical Target
↓
Train Regression Model
↓
Learn Relationships
↓
New Input
↓
Predict Numerical Value
That is the basic idea of regression.
Quick Regression vs Classification Recap
Classification
Question:
Which category?
Example:
Spam / Not Spam
Regression
Question:
What numerical value?
Example:
$410,000
Memory Rule
Classification = Which one?
Regression = How much?
Key Takeaways
Remember these points:
- Regression is a supervised machine learning task.
- Regression predicts numerical values.
- Features are the clues used for prediction.
- The target is the numerical value we want to predict.
- Regression models learn relationships from historical examples.
- Prediction errors are measured during training and evaluation.
- A trained model can predict values for unseen data.
- Regression predictions are estimates, not guarantees.
- Classification predicts categories.
- Regression predicts quantities.
- A number used only as a category code does not make a problem regression.
- Linear Regression is one regression method.
- Logistic Regression is mainly used for classification.
- Regression can use one or many features.
- Statistical relationships do not automatically prove causation.
Final Thoughts
Regression becomes easy to understand once you focus on one idea:
Regression predicts numerical values.
A model learns from previous examples, studies how input features relate to a numerical target, and then uses those relationships to estimate values for new data.
The next step is to study the most important regression method in more detail:
Linear Regression in Machine Learning
There we can explore:
- regression equation
- slope
- intercept
- coefficients
- simple vs multiple linear regression
- loss
- gradient descent
- real examples
- model evaluation
Continue Learning
- Linear Regression, Multiple Regression & Real-Life Examples
- How Regression Models Are Evaluated: MAE, MSE, RMSE, R², Overfitting & Improvement
- What Is Supervised Learning and How Does It Work?
- How Does Machine Learning Work? 5 Simple Steps for Beginners
Written and reviewed by Hina Majeed.
Last updated: October 21, 2026.