Return to Video

vimeo.com/.../430695849

  • 0:02 - 0:07
    Next thing we have to do
    is to take our acts.
  • 0:07 - 0:11
    For each x value,
    we have to subtract the mean of x,
  • 0:11 - 0:16
    and then square it and sum,
    and we will have this 'get_ssxx',
  • 0:16 - 0:22
    which is the sum of squared x.
    What this will do here
  • 0:22 - 0:28
    is to take the mean of x
    using numpy and will say x minus the mean.
  • 0:28 - 0:32
    So it will be element wise to
    each value of x in the list.
  • 0:32 - 0:35
    It will have the mean taken away,
    then we're going to square it
  • 0:35 - 0:41
    and we're going to sum the whole thing
    and will set a new attribute 'self.ssxx'.
  • 0:42 - 0:45
    And so if we make an instance of
    linear regression,
  • 0:45 - 0:48
    pass in x and y and then
    we call this method,
  • 0:48 - 0:52
    we will see we can now
    access this attribute 'ssxx'.
  • 0:53 - 0:59
    The next thing we will do is
    we will get some of the squares
  • 0:59 - 1:05
    using x and y,
    and what we will do here is
  • 1:05 - 1:08
    take x minus the mean of x,
    like we did up here.
  • 1:08 - 1:12
    Now we're going to take
    y minus the mean of y.
  • 1:12 - 1:17
    And then we're going to
    elementwise multiply them,
  • 1:17 - 1:22
    meaning this right here will be
    a collection of data.
  • 1:22 - 1:27
    So we're going to multiply
    the index position item zero.
  • 1:27 - 1:30
    by the index position item of zero
    in this collection of data,
  • 1:30 - 1:35
    and do that for each element
    in these collections of data,
  • 1:35 - 1:38
    and these containers,
    and then will sum them up.
  • 1:38 - 1:42
    That will give us
    the sum of squares of x and y.
  • 1:46 - 1:49
    So now,
    if we run this...
  • 1:51 - 1:57
    ...you'll see that we now have
    bound a value to 'ssxy'.
Title:
vimeo.com/.../430695849
Video Language:
English
Duration:
02:01
GA.contentdept edited English subtitles for vimeo.com/.../430695849
GA.contentdept edited English subtitles for vimeo.com/.../430695849

English subtitles

Revisions