-
Next thing we have to do
is to take our acts.
-
For each x value,
we have to subtract the mean of x,
-
and then square it and sum,
and we will have this 'get_ssxx',
-
which is the sum of squared x.
What this will do here
-
is to take the mean of x
using numpy and will say x minus the mean.
-
So it will be element wise to
each value of x in the list.
-
It will have the mean taken away,
then we're going to square it
-
and we're going to sum the whole thing
and will set a new attribute 'self.ssxx'.
-
And so if we make an instance of
linear regression,
-
pass in x and y and then
we call this method,
-
we will see we can now
access this attribute 'ssxx'.
-
The next thing we will do is
we will get some of the squares
-
using x and y,
and what we will do here is
-
take x minus the mean of x,
like we did up here.
-
Now we're going to take
y minus the mean of y.
-
And then we're going to
elementwise multiply them,
-
meaning this right here will be
a collection of data.
-
So we're going to multiply
the index position item zero.
-
by the index position item of zero
in this collection of data,
-
and do that for each element
in these collections of data,
-
and these containers,
and then will sum them up.
-
That will give us
the sum of squares of x and y.
-
So now,
if we run this...
-
...you'll see that we now have
bound a value to 'ssxy'.