WEBVTT

00:00.080 --> 00:01.800
Congratulations, guys.

00:02.120 --> 00:08.640
All the evaluation graphs shows that our model is well trained.

00:08.880 --> 00:14.520
Now let's make a prediction here for a new car mileage.

00:14.640 --> 00:19.480
Let me start with a new sample car with four cylinders.

00:19.480 --> 00:21.720
Displacement 150.

00:21.760 --> 00:23.280
Horsepower 100.

00:23.480 --> 00:28.360
Weight 3001 or 15 for acceleration.

00:28.360 --> 00:30.480
Model year 1976.

00:30.600 --> 00:36.160
Origin is from America and set the zeros for European and Japanese.

00:36.400 --> 00:38.560
Okay, this is the sample car.

00:38.600 --> 00:47.160
As I told you before, we need to convert the data that the array that we created here named as new

00:47.200 --> 00:47.800
car.

00:48.080 --> 00:51.960
We need to convert it to a data frame.

00:51.960 --> 00:56.600
So we're going to create new new car data frame.

00:56.880 --> 00:59.000
We need to use the pandas.

00:59.160 --> 01:05.340
Pandas model and library dot data frame and set it to the new car.

01:05.340 --> 01:13.820
So we are converting this array into a data frame with the pandas library and the new car scaled equals

01:13.820 --> 01:18.660
to scalar dot transform new car DataFrame.

01:18.660 --> 01:24.020
This line of code creates a new data frame from your input data.

01:24.060 --> 01:25.020
New car.

01:25.180 --> 01:31.100
The new car creates a new data frame from your input data.

01:31.100 --> 01:37.300
New car and the new car wraps it in a list to ensure proper shape.

01:37.420 --> 01:44.580
Y scalar expects 2D input samples times features.

01:44.780 --> 01:55.220
So this is why we use the data frame to convert this new car, the list or a dictionary to a data frame,

01:55.220 --> 01:57.460
which is a 2D input.

01:57.460 --> 01:59.940
The new car scaled.

01:59.940 --> 02:07.120
We used the scaled because our model was trained on scaled data.

02:07.160 --> 02:12.440
Applies the same scaling that was used on your training data.

02:12.640 --> 02:19.200
Uses the fitted scalar like standard scalar or minimum maximum scalar.

02:19.400 --> 02:25.160
Ensures the new data has the same distribution as training data.

02:25.200 --> 02:28.040
Your model was trained on scaled data.

02:28.080 --> 02:33.400
You should use the scaled data and scalar dot transform.

02:33.520 --> 02:40.800
New predictions must use the same scaling, otherwise prediction will not be inaccurate.

02:40.800 --> 02:43.880
So this is a very important thing.

02:43.920 --> 02:51.000
Now let's make the prediction so predicted MPG equals to model dot predict.

02:51.040 --> 02:58.040
We use the function predict from the model that we trained equals to new car scaled.

02:58.040 --> 03:02.240
That is this scaled parameter okay.

03:02.440 --> 03:06.490
The predicted mpg for the new car will be displaced here.

03:06.730 --> 03:07.770
And here we go.

03:07.810 --> 03:10.970
It's 20.34.

03:11.130 --> 03:11.690
Okay.

03:11.730 --> 03:13.610
So congratulations guys.

03:13.610 --> 03:15.530
We made our prediction.

03:15.850 --> 03:18.970
This is a scaled prediction.

03:18.970 --> 03:22.850
We succeeded in getting scaled parameters.

03:22.850 --> 03:28.090
We transformed those parameters into scaled one.

03:28.330 --> 03:38.090
Then we used them by passing, uh, the new car scaled object to the predict function from the model

03:38.090 --> 03:41.050
and returning the predicted mpg.

03:41.170 --> 03:51.850
Okay, so this is how we get the predictions, how we scale the features, how we scale the parameters

03:51.850 --> 03:59.370
and make them a common and standardized for all functions for all uh, units.

03:59.610 --> 04:03.130
And we get the predicted value correctly.
