WEBVTT

00:00.000 --> 00:07.400
Hey folks, welcome to notebook 2.0 where we'll start really diving into machine learning.

00:07.400 --> 00:14.160
And I hope that the notebook 1 and 1.5 were a good preparation, good warm up, good refresher

00:14.160 --> 00:17.800
on your data science skills.

00:17.800 --> 00:21.000
Before we actually get started, I do want to make sure we're all set up with our notebook.

00:21.000 --> 00:26.560
We don't want to be wondering whether what's going wrong is our notebook infrastructure or

00:26.560 --> 00:27.880
our code.

00:27.880 --> 00:33.040
So I'm going to run this, it's already mounted, but for you, it's probably going to come

00:33.040 --> 00:40.760
with a whole set of dialogue boxes for configuring Google Drive, connecting it to this particular

00:40.760 --> 00:41.760
notebook.

00:41.760 --> 00:44.000
It also will take a moment to just start running.

00:44.000 --> 00:47.200
Let's also run our import blocks.

00:47.200 --> 00:51.360
Here's this one and this one.

00:51.360 --> 00:57.200
And we're importing a lot of our typical NumPy, pandas, and pi plot.

00:57.200 --> 01:02.800
Also Seaborn, we'll be using that and our ability to display images.

01:02.800 --> 01:07.280
And for the first time, we're going to import some things from Scikit Learn, which is a

01:07.280 --> 01:11.160
science library devoted to machine learning.

01:11.160 --> 01:15.520
And we're going to be importing a linear regression model, which is different from our linear

01:15.520 --> 01:18.400
regression formulas.

01:18.400 --> 01:22.520
The ability to split data into testing and training will be talking about that in a moment.

01:22.520 --> 01:28.080
And Standard Scaler is a tool Scikit Learn has for standardizing our data.

01:28.080 --> 01:33.520
All right, so make sure you've run all three of those so that you're all set up.

01:33.520 --> 01:39.560
And now we'll go and talk about what we're doing here.

01:39.560 --> 01:44.560
So supervised machine learning, that's what we're doing here.

01:44.560 --> 01:48.520
It involves helping an algorithm learn.

01:48.520 --> 01:50.320
And we'll talk a lot about what that means, exactly.

01:50.320 --> 01:52.480
What does it mean for a model to learn?

01:52.480 --> 01:57.320
And we're going to train it based on some data.

01:57.320 --> 02:00.120
So we'll train it to make a prediction.

02:00.120 --> 02:03.640
It'll provide an output, which is called a prediction.

02:03.640 --> 02:09.640
And this phrase gets people a little bit.

02:09.640 --> 02:12.440
We're going to be talking about features, different features.

02:12.440 --> 02:14.320
And those are just inputs.

02:14.320 --> 02:20.480
So think columns in a data frame, like which of these characteristics of our data are

02:20.480 --> 02:21.480
important.

02:21.480 --> 02:25.280
Those are the ones we'll feed to the model as features.

02:25.280 --> 02:30.960
Now when the model makes a prediction, when we train the model, we'll give it the features,

02:30.960 --> 02:34.440
we'll give it all of the data that we wanted to train on.

02:34.440 --> 02:37.920
And we'll also give it the answers, the target.

02:37.920 --> 02:45.000
So the first thing we'll be doing, for example, is trying to predict car sales numbers.

02:45.000 --> 02:46.920
How much will this car sell for?

02:46.920 --> 02:49.440
What will it price be?

02:49.440 --> 02:56.040
Given things like horsepower, engine size, fuel efficiency, and several other elements

02:56.040 --> 02:58.160
of a car.

02:58.160 --> 03:05.600
Now what will give it is, hey, here is all the data we think could be helpful for predicting

03:05.600 --> 03:08.240
our car's data.

03:08.240 --> 03:10.720
And also, here's the prices.

03:10.720 --> 03:11.720
Here's the answers.

03:11.720 --> 03:17.080
So we can learn from that, hey, given x and y, z was the answer.

03:17.160 --> 03:20.960
And this x and y, this z was the answer.

03:20.960 --> 03:26.040
So the correct purpose of the goal is for it to be able to predict it, and it needs

03:26.040 --> 03:31.080
to know, hey, what are the general values that I can predict it based on, and I can reverse

03:31.080 --> 03:40.680
engineer exactly what model, exactly what formula will get me from the inputs to the output.

03:40.680 --> 03:43.440
And we give also called the correct answer, the label.

03:43.440 --> 03:46.120
Since we've labeled the data, this is the answer.

03:46.680 --> 03:49.560
This is this answer, et cetera.

03:49.560 --> 03:52.800
Label will make even more sense when it gets a classifying data.

03:52.800 --> 03:55.760
But we'll see that in a little while.

03:55.760 --> 03:58.600
But it'll make more sense as a term for that.

03:58.600 --> 04:05.160
OK, so we're going to give it training data, inputs, paired with the correct label with

04:05.160 --> 04:09.000
features, and it will give it the correct answer.

04:09.000 --> 04:13.560
Now when we train it, we'll give it these characteristics, fuel efficiency, engine size

04:13.560 --> 04:20.760
horsepower, and typically it's like one row per car, right, one set of data.

04:20.760 --> 04:26.720
And also the label, the correct answer, hey, what was the price for that car?

04:26.720 --> 04:35.720
And then we hope that it will be able to learn, hey, what features, what inputs, what values

04:35.720 --> 04:42.400
those features lead to, what values of prices of our target.

04:42.400 --> 04:50.320
So that's for cars, if we wanted a classification, we would have dogs and cats, pictures of dogs

04:50.320 --> 04:51.320
and cats.

04:51.320 --> 04:52.720
And the features would be those images.

04:52.720 --> 04:55.240
And the labels, which again makes more sense now that we're classifying.

04:55.240 --> 04:58.040
We labeled this one a dog, this one a cat.

04:58.040 --> 05:02.360
And if the model sees enough pictures of dogs and cats, it'll learn, hey, what about

05:02.360 --> 05:04.520
this picture makes it a cat?

05:04.520 --> 05:08.240
What about this picture makes it a dog?

05:08.240 --> 05:11.960
Now it's not seeing season quotes here.

05:11.960 --> 05:13.400
It's just looking at numbers.

05:13.400 --> 05:18.160
It's just looking at a Python list of numbers, typically.

05:18.160 --> 05:25.240
So a colorful photo of a cat would actually be a whole list of pixels, red, green, and

05:25.240 --> 05:26.240
blue values.

05:26.240 --> 05:28.000
How much red, how much green, how much blue?

05:28.000 --> 05:30.040
Because it's just numbers to the machine.

05:30.040 --> 05:35.040
It doesn't know cats, it doesn't know dogs, it just knows data.

05:35.040 --> 05:37.840
And all outputs are going to be made, are going to be numbers too.

05:37.840 --> 05:42.600
So cat versus dog, we might label cat the number one dog, the number two.

05:42.600 --> 05:49.920
And it says, hey, when I see this set of pixels that look a little bit like this, that looks

05:49.920 --> 05:54.800
like it goes with one, when I see a pixels that have this, these numbers in them, that

05:54.800 --> 05:57.360
looks like it goes for with two.

05:57.360 --> 06:01.840
So then I can predict, oh, this one looks like a one, this one looks like a two.

06:01.840 --> 06:05.680
We're also going to split off our data, not just in a training data, but into testing

06:05.680 --> 06:07.160
data as well.

06:07.160 --> 06:11.760
This data will be, will withhold from the model, we won't give it all.

06:11.760 --> 06:18.000
Instead we will hold data in reserve so that we can say, okay, you learned on this data,

06:18.000 --> 06:22.240
now here's a quiz, here's the test data.

06:22.240 --> 06:28.240
How good are you given this, given what you learned, run your predictions on the features

06:28.240 --> 06:35.120
of this test data, on the inputs, on the values we give you, and what's your prediction?

06:35.120 --> 06:39.640
And we'll measure that against the actual results for that testing data.

06:39.640 --> 06:42.760
So you know, this is like, okay, when you saw a dog, you want to solve it, a dog saw what

06:42.760 --> 06:47.240
a cat you think you got the idea, here's a picture of a dog, here's a picture of a cat,

06:47.240 --> 06:52.360
which one do you think is this a cat or a dog, is this a cat or a dog, and it's never seen

06:52.360 --> 06:54.840
those exact cats or dogs before.

06:54.840 --> 06:58.160
It's never seen these cars before, it doesn't know what prices they are.

06:58.160 --> 07:03.160
And if it's learned, it's less and well, it'll do a good job of predicting it, predicting

07:03.160 --> 07:05.320
new data based on the old one.

07:05.320 --> 07:08.240
So it wouldn't be very helpful if it was just like, yeah, I've seen that picture, you told

07:08.240 --> 07:10.680
me it was a cat, I remember it, that's a cat.

07:10.680 --> 07:14.360
You showed me this picture of a dog, I remember it's a dog, I remember you told me, it's

07:14.360 --> 07:17.200
like, okay, we'll show you a new picture, it's like, I've never seen that before, but

07:17.200 --> 07:21.920
I think based on what I've seen a cat's a dog, that one's a dog, and you're like, oh,

07:21.920 --> 07:25.240
no, that one's a cat, oh, sorry, heartbreaker.

07:25.240 --> 07:28.720
But hopefully our data, our model will be pretty good at it.

07:28.720 --> 07:32.520
And generally, we're going to split it into a data set testing and training.

07:32.520 --> 07:38.440
And typically, 80% of the data we use training and 20% testing.

07:38.440 --> 07:41.840
That's what people have found is very helpful.

07:41.840 --> 07:44.480
All right, that's our introduction.

07:44.480 --> 07:45.000
Let's get started.

