Hello and welcome back.
Let's have a look at simple linear regression.
So here's the equation.
And we will look at the parts of this equation one by one.
So on the left we have our dependent variable which we're trying to predict.
On the right we have our independent variable which is the predictor.
here we have b0 which is the y intercept also known as a constant.
And b1 is the slope coefficient.
Now to make things more fun we're going to use that example
we mentioned about predicting the output of potatoes
on a farm based on the amount of fertilizer that we use.
So here's our equation.
And if we modify it to fit our example it will look like this.
And let's say that we ran the simple linear regression algorithm.
And it came up with the following values B0 equals eight tons
and b1 equals three tons per kilogram.
So what does this mean in terms of the graphical representation.
How to how can we better understand this on an intuitive level.
So let's plot a simple scatter plot.
So here we have on the x axis a nitrogen fertilizer used in kilograms
as our x1, variable.
And here we have the Y variable, which is a potato yield in tons.
And here on the scatter plot we have several data points.
What are these data points.
Well each one represents a separate harvest on the farm
that we are talking about.
So, multiple times, the potatoes were harvested over
many years, and the farmer recorded how much fertilizer they used
and also how many potatoes they were able to harvest in that specific season.
So there is a scatter plot.
And what this, equation on the left represents
is a sloped line that goes through a point.
the y intercept is over here.
That's our eight tons.
And what the slope coefficient means is that if you increase
the amount of nitrogen fertilizer by one kilogram,
then the amount of potato output
will increase by three tons.
And of course, these numbers are made up for illustrative purposes.
So there we go. That's how the simple linear regression works.
I look forward to seeing you next time.
Until then, enjoy machine learning.