Digital Nest Blog

What is Linear Regression in Machine Learning?

Table of Contents

Welcome to DigitalNest. As part of this article, we help you to understand what is Linear Regression and how it is useful.

If you have read any articles on machine learning, you might have heard about Linear Regression. You might wonder what is Linear Regression and how it is used in machine learning. Before, we try to understand Linear Regression, let us understanding briefly what is Machine Learning.

Machine Learning is all about training machines to understand the patterns and relations in the business environment (represented by data variables) by themselves without any explicit instructions from humans. This is similar to how humans start learning alphabets, identifying colors and animals when they are kids. A mother or teacher repeatedly trains the kids on identifying the alphabets or colors or animals. Through the repetitions, kids slowly recognize different patterns or shapes of the objects so that they can identify them when they are shown to them. It is important to note down that in this training process, there are no logical instructions given to kids. In Machine learning also, there are no logical instructions (software programming) given to machines but through repeated training, machines are made to understand the patterns or identify the objects by themselves.

There are various statistical algorithms that are used to train the machines. Linear Regression is the first algorithm in the machine learning world. Before we learn how Linear Regression works, let us understand what are the applications of Linear Regression? for example, You want to buy a house of 1000 square feet in the Hyderabad. You will first enquire about the the price of houses that have been sold. The following table contains the prices of sold houses with different sizes.

House Size (Square Feet) Price (Rs) Price Per Square Feet
 800    32,00,000      4,000
950    40,85,000        4,300
1090    41,42,000         3,800
1220    50,02,000          4,100
1545    59,48,250          3,850

From the above information, you find that price per square feet ranges from 3,800 to 4,300. With this information, you will try to predict what could be the price of a house with 1000 square feet. This way of predicting is nothing but application of Linear Regression. To understand how it is Linear Regression, let us a draw a scatter plot between House Size and Price.

The straight line in the above graphs represents relationship between market price of the house and the size of the house (square feet). In this example, we made assumption that the price of the house is linearly dependent on size of the house i.e. for every one square feet increase, the price of the house also increases at fixed value. This also means that the price difference between houses with sizes of 1000 and 1100 square feet is same as the price difference between sizes of houses with 1100 and 1200.

In simple terms, Linear Regression is nothing but a linear relationship (represented by line or plane) between two variables. In our example, the two variables are House Price and House Size. Technically, House Price is called Dependent variable and House Size is called dependent variable. Once Linear regression is build, the house price (Dependent) can be estimated / predicted for a house with size of any square feet. If there are more than one independent variable, it is called Multi Linear Regression.

Thanks for visiting us and contact us to explore the exiting field of Data Science and Machine Learning.