What Is Linear Regression? A Plain-Language Explanation
Linear regression is a supervised learning method that predicts a number by fitting a straight-line relationship between one or more input variables and a continuous output, such as a house price or a temperature.
The simple analogy
Think of plotting points on graph paper and drawing a single straight line through them so the line sits as close to all the points as possible. That line is the model, and you can use it to guess the answer for a new point.
How the line is chosen
A line with one input has the form Y = a + bX, where b is the slope and a is the intercept. The algorithm adjusts these values to minimize the squared differences between predicted and actual values, a measure called the residual sum of squares.
One input versus several inputs
| Type | Number of inputs | Example |
|---|---|---|
| Simple linear regression | One | Predict price from house size |
| Multiple linear regression | Two or more | Predict price from size and bedrooms |
Where it is commonly used
Linear regression is used for forecasting demand, estimating sales, analyzing trends, and any problem where the answer is a quantity rather than a category.
Honest caveats
A straight line assumes a roughly linear relationship. If the true pattern is curved, or a few extreme points dominate the data, the predictions can be misleading, so checking a scatterplot and the residuals is a useful step.
FAQ
Is linear regression classification or regression?
It is a regression method because it predicts a continuous number, not a category label.
What does the slope represent?
The slope shows how much the predicted output changes for each one-unit change in the input.
What is a residual?
A residual is the gap between the actual value and the value the line predicts.
Can linear regression use more than one input?
Yes, using several inputs is called multiple linear regression.
Key takeaways
- Linear regression predicts a number with a straight-line model.
- The line is fitted by minimizing squared errors.
- One input is simple, several inputs is multiple.
- It works well when the relationship is close to linear.
Continue with what is logistic regression and what is supervised learning.
Sources
Learn by doing
Read a guide, then practice with bite-sized AI lessons you can take offline.
Start learning free