Sitemap
T3CH

Snoop & Learn about Technology, AI, Hacking, Coding, Software, News, Tools, Leaks, Bug Bounty, OSINT & Cybersecurity !¡! But, not limited 2, anything that is Tech Linked…You’ll probably find here ! ;) — Stay ahead with Latest Tech News! -> You write about? Just ping to join !

Linear Regression Explained

3 min readAug 24, 2026

--

We’ll build the intuition behind linear regression, understand how a model learns its parameters, and see what the training process looks like.

Linear regression is used to find relationship between features and a label. Linear regression model works with numbers so features and label should be numerical values.

Features are inputs or independent variables that are used to predict label (output value)

Suppose we have historical data about the house size and its price in thousand dollars. Given the size of a new house, we want to predict how much it will cost.

This is a regression problem because the output is a continuous numerical value.

House Dataset

Plotting these point would give the following graph:

Press enter or click to view image in full size

A model can be created by drawing a best fit line through the points:

Press enter or click to view image in full size

Linear regression equation

The model would be mathematiclly:

  • y house price — the value we want to predict.
  • m is the slope of the line.
  • x is house size — input value.
  • b is the y-intercept.

In ML terms, the linear regression model would be:

  • y is the predicted label — the output.
  • b is the bias of the model. Bias is a parameter of the model and is calculated during training.
  • w1​ is the weight of the feature. Weight is a parameter of the model and is calculated during training.
  • x1​ is a feature — the input.

weight and bias are learned during training to produce the best model.

Get Hamza Ahmed’s stories in your inbox

Join Medium for free to get updates from this writer.

From the model or line we made, the bias is 65.79 (where the line intersects at y) and the weight is 0.1565 (slope of the line)

Press enter or click to view image in full size

The model can be defined from this equation:

This equation can be used to make predictions, we would need the input value (house size) to find the output (house price) according to the model we built.

Models with multiple features

Although the example in this section uses only one feature. In real world, the house price depend on multiple features like no. of floors, area, location, no. of basic amenities, etc. For example, a model that takes five features would be written as follows:

Conclusion

By learning the weights and bias from historical examples, the model can represent the relationship between features and a label as a line or linear equation. While our example used only house size, the same idea can be extended to multiple features, allowing the model to capture more complex real-world relationships.

--

--

Hamza Ahmed
Hamza Ahmed

A Computer Science graduate working at the intersection of Software Solutions, machine learning, and data science. Learning and writing about what I learn.

T3CH
T3CH

Snoop & Learn about Technology, AI, Hacking, Coding, Software, News, Tools, Leaks, Bug Bounty, OSINT & Cybersecurity !¡! But, not limited 2, anything that is Tech Linked…You’ll probably find here ! ;) — Stay ahead with Latest Tech News! -> You write about? Just ping to join !