Return to Video

Visualizing Regression - Intro to Machine Learning

  • 0:00 - 0:03
    Of course there's one more thing that I should always be doing when I'm
  • 0:03 - 0:04
    practicing machine learning.
  • 0:04 - 0:08
    And that we've neglected so far which is visualizing our results so
  • 0:08 - 0:10
    let me do that right now.
  • 0:10 - 0:14
    So what I do here, I make a scatter plot of all my data points and
  • 0:14 - 0:15
    then I also write a line like this.
  • 0:15 - 0:18
    plt.plot is going to draw a line.
  • 0:18 - 0:23
    The x values of some of the points along the line will be the ages.
  • 0:23 - 0:25
    And the y values will be the predictions for
  • 0:25 - 0:27
    the ages that are given to me by the regression.
  • 0:27 - 0:29
    So these are kind of like the features and
  • 0:29 - 0:33
    the predictions and then this is just some formatting information.
  • 0:33 - 0:35
    Then I apply some labels and I show it.
  • 0:35 - 0:38
    And I use the show command to see it and
  • 0:38 - 0:40
    it gives me a picture that looks like this.
  • 0:40 - 0:43
    Where these are all the points that we had just like before, and
  • 0:43 - 0:45
    now I've overlayed them with this blue line.
  • 0:45 - 0:48
    And just by eye you can tell the regression isn't doing anything crazy.
  • 0:48 - 0:52
    Always a good sanity check is just to look at the results of your regression.
  • 0:52 - 0:56
    Especially if it's a one dimensional regression like this where you only have
  • 0:56 - 0:58
    one input variable, like the ages.
  • 0:58 - 1:00
    Then it's very straightforward to just look at it by eye and
  • 1:00 - 1:01
    see how things are going.
Title:
Visualizing Regression - Intro to Machine Learning
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
ud120 - Intro to Machine Learning
Duration:
01:03

English subtitles

Revisions Compare revisions