Goto

Collaborating Authors

 smooth introduction


A Smooth Introduction to Linear Regression and its Implementation in PyTorch (Part-I)

#artificialintelligence

The term linear regression might seem a bit complex at first, but don't worry, it is a simple but powerful concept. Let us go through an example to understand the concept better. I will throw some random data here and see what happens. Say that we have two variables h and r, that refer to the time of the day and how many pages a person read, respectively. Let's assume that the person starts reading at 9:00 AM and finishes at 2:00 PM.


A Smooth Introduction to Linear Regression and its Implementation in PyTorch (Part-II)

#artificialintelligence

So in Part-I I gave a simple introduction on what linear regression is and how we can find the equation of the best fit line for our data. In this post, I will show you how to implement the task we worked on in Part-I in PyTorch. The input size is set to 1 since our inputs to the model are scalars h (hour in the day). The output is also set to 1 since we will get only one value returned for r (number of pages being read). So, basically, we will leave our program to find the best values for B_0 and B_1 that we calculated in the previous part of this tutorial.