## Coding It Up - Intro to Machine Learning

• 0:00 - 0:04
Welcome now to the coding portion of the regression lesson.
• 0:04 - 0:10
We start, as always, on Google and we look for what sklearn has to offer us.
• 0:10 - 0:12
As you can see, there's plenty going on here.
• 0:12 - 0:16
This linear regression is what we'll end up using eventually.
• 0:16 - 0:20
But I actually think this link is a better one to start at because it
• 0:20 - 0:24
gives us a little bit more of an introduction to generalized linear models.
• 0:24 - 0:28
So we have here a formula that, it's a little bit hard to tell, but
• 0:28 - 0:31
this is just rewriting y equals mx plus b, but
• 0:31 - 0:36
now we can have more than one x available to us.
• 0:36 - 0:38
We'll get into this a little bit later in the lesson right now,
• 0:38 - 0:40
but at least this tells us that we're in the right place for
• 0:40 - 0:44
something that has a linear form to it.
• 0:44 - 0:47
Scrolling down a little bit, I see something called ordinary least squares.
• 0:47 - 0:48
The exact name for
• 0:48 - 0:53
the code is linear regression, and this looks like exactly what I want.
• 0:53 - 0:55
I have a variety of points.
• 0:55 - 0:57
I'm fitting them with a line.
• 0:57 - 1:00
And maybe even better, I have some example code that can get me started.
• 1:00 - 1:04
I hope you recognize that the code here really isn't all that different
• 1:04 - 1:08
from the types of codes that we were seeing for the supervised classifiers.
• 1:08 - 1:10
• 1:10 - 1:13
from sklearn import linear_model.
• 1:13 - 1:18
Within linear_model, there's an object called linearRegression and
• 1:18 - 1:20
we use that to create our classifier.
• 1:20 - 1:22
The next thing that we do is we fit our classifier.
• 1:22 - 1:24
And then here,
• 1:24 - 1:28
they're not making predictions with it, although we'll be doing that as well.
• 1:28 - 1:31
What they're doing here is they're reading out the coefficients, or
• 1:31 - 1:33
what we called the slope.
• 1:33 - 1:37
Scrolling down a little further, I see that there's a more detailed example here
• 1:37 - 1:39
that I could use to help me if I get stuck anywhere.
• 1:40 - 1:43
But as it happens, this is going to be enough to get us off the ground.
Title:
Coding It Up - Intro to Machine Learning
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
ud120 - Intro to Machine Learning
Duration:
01:44
 Udacity Robot edited English subtitles for 06-31 Coding_It_Up Udacity Robot edited English subtitles for 06-31 Coding_It_Up Cogi-Admin edited English subtitles for 06-31 Coding_It_Up

# English subtitles

## Revisions Compare revisions

• API
Udacity Robot
• API
Udacity Robot
• API