No, simple linear regression is a straightforward approach for predicting Y on the basis of a single
predictor variable X.
So if you take only one predictor variable, it is called simple linear regression.
If we assume linear relationship between X and Y.
Mathematically, it can be written as Y is approximately equal to be zero plus between X. It is nearly
equal to because the value of Y that model will give may not be exactly equal to the value in our observation.
Will come back to the thought later.
Here, let us select only one variable from the dataset to predict price of the house.
Let's say I choose the average number of rooms for this simple model so we will regress house price
onto the number of rooms by putting the model price is nearly equal to the zero plus bedevilling times.
Room number error zero and B1 are the unknown terms which are known as model coefficients or model parameters
for the particular case of simple linear regression between is the slope and which is the intercept.
Once we use the training data to estimate these two parameters because it won't be the one, you'll
be using this heart symbol to denote estimated parameters from our data.
So we will raise prices are going to be zero plus between cap times number of rooms.
So for estimating the values of what parameters, we will be using the data points in our dataset.
If you remember, our house pricing data set has 506 observations.
This number of data points for general-purpose will be denoted by an smolan.
So Smolan is 506 for our dataset.
What this means is we have five hundred six pairs of X and Y values and that goal is to obtain coefficient
estimate, zero cap and we have UNCAP such that the linear model fits the available data such as Vivint
cap is equal to zero plus one cap X one, and if you generalize it for any eye, it is Y is nearly equal
to be zero.
Karplus be the one cap ex.
In other words, we want our estimate in line to be as close to this point as possible.
One method for measuring this closeness of our line is called the least squared method, which will
discuss now.
Once we done the model and get a line, the line will be predicting a value of by at each point I.
This predicted value will be denoted by a gap.
Now, we do have the actual values of where each of these points, the difference between these actual
values and the predicted value is that, Miss, this is the residual and it is denoted by, as you can
see in the graph, using the training data that we had, we have the line using the Betaseron be the
one that we calculated.
And this line is drawn here in the blue color.
Each of these points is also plotted.
Some of these points are exactly on the line, but most of them are missing the distance of that point
from the line you need, as it will at some point, this residual is positive.
At some point this is negative.
When we are taking out the total residual of the sample, we cannot straight away from the map because
some are positive and negative, therefore will define a new quantity called residual sum of squares.
Now, since Odyssey's is something the root of each residual, it is representing the total error in
this formula.
You can see that for each of the point.
We are subtracting the actual observed value from the predicted value and then squaring it.
And we are doing this for all of the points.
Now we have the total error of our predicted line and we want to minimize this error.
So using calculus and matrix algebra, we will get these formulas for Betaseron be the one for which
this error is minimized.
So this approach is called Lee Square Meter, because we are minimizing the squared error squared sum
of errors.
So this Odyssey's value we are trying to minimize by differentiating and putting it to zero will get
these values of between carbon zero.
Got what this value, what these values are zero.
And B, the one the calculated sum of squares will be minimum.
So we this summation of X minus X, but if you remember, what is the meaning of the sample.
So for each data point we will find out this different of each point from each mean and then will multiplied
with the difference of each y y variable with X mean, you'll sum this product for all the points and
will divide it by the difference of X from its mean squared I all points.
Similarly, what does it mean.
Value of Y minus beta one group times mean value of X.
So we have mean value of X and Y.
We first need to calculate the value.
When we put between value and this formula, we will get to be the zero value.
So using these formulas for simple linear regression, you can get the Beatles, you know, and be the
one values.
For our model, where we selected House Price as Y and Bromium as X environ this morning, this thought
assortment, I get this result.
I have highlighted the the values in this bluebox.
This intercept is zero and room number is the X variable.
And this is giving the confusion of this variable.
So this is Beethoven.
So Beethoven is coming out as nine point zero nine and intercept is coming is minus thirty one point
six nine.
In other words, this means that if I increase the number of rooms by one unit, the price of house
will increase by nine units.
What is the meaning of all these other values that will be learning in the coming reduce funding to
NOTARIS?
You do not need to remember these formulas because these software packages will be doing it for you.
As you saw in this video and you will see in the coming videos, we'll be telling you the mathematical
concept behind the theory and discussing those mathematical formulas.
Also, keep in mind that you do not need to remember these formulas.
You just need to understand the concept behind them.
The indication that I tell you that will help you interpret the result.
That understanding of result is very important.
But you do not need to memorize these formulas since you will be using a software package which will
be applying all these formulas and getting the results for you to preparing the data is important for
running a model is important and interpreting the data accurately is the most important.
Remembering formula is not important in machine learning, nor also even if you do not understand the
mathematical part of this.
Don't be worried.
You can still run a machine learning model and you can use the results in your professional life.
But I highly recommend that you go through all the lectures very carefully to understand the core concepts
behind all these machine learning methods.