WEBVTT

00:00.120 --> 00:00.960
Welcome back.

00:01.280 --> 00:07.520
We generated this table having two columns size and price.

00:07.560 --> 00:12.120
Now we need to introduce something called reshaping data.

00:12.160 --> 00:18.400
Our current data is a combined and concatenated array.

00:18.560 --> 00:21.200
This is the form of our data.

00:21.200 --> 00:26.040
And we use it to make this table and plot.

00:26.080 --> 00:32.480
If we if we need to plot on a graph using Matplot library.

00:32.480 --> 00:42.200
But here we need to send our data to TensorFlow in order to process it, and later for training our

00:42.240 --> 00:42.760
model.

00:42.800 --> 00:47.720
So we're going to do something called reshaping data.

00:47.760 --> 00:59.080
Reshaping is essential because machine learning algorithms expect features to be in a 2D format, where

00:59.120 --> 01:03.880
each row is a sample and each column is a feature.

01:04.040 --> 01:05.840
Please pay attention to this.

01:05.960 --> 01:11.320
Each row is a sample and each column is a feature.

01:11.360 --> 01:17.790
Before we have a 1D array 1.5, 2.02.5.

01:17.830 --> 01:28.510
After we have a 2D array 1.5, 2.0 and 2.5, and the others are filled with other columns.

01:28.510 --> 01:31.590
So we need to transform 1D array.

01:31.790 --> 01:37.510
Or we we need to combine the 1D arrays into two d array.

01:37.750 --> 01:38.270
Okay.

01:38.470 --> 01:42.870
So here we are going to prepare the data for TensorFlow.

01:43.070 --> 01:48.990
Start with x equals to data the data that we created before.

01:49.150 --> 01:52.870
So we are referring to those data.

01:53.030 --> 01:56.990
We need to access from this data the size.

01:57.150 --> 02:07.470
So get the column and pay attention for the name of the column because it's case sensitive.values.re

02:07.710 --> 02:08.390
shape.

02:08.550 --> 02:11.230
This is the function that we're going to use.

02:11.470 --> 02:14.270
And I'll use minus one.

02:14.310 --> 02:18.070
The first parameter and the second parameter is one.

02:18.110 --> 02:21.710
Also we're going to create a variable called y.

02:21.950 --> 02:26.060
And here y equals to Data price.

02:26.100 --> 02:27.900
I'm accessing this column.

02:27.900 --> 02:34.780
Price values dot reshape and again passing minus one and one.

02:34.980 --> 02:39.100
Now let's learn about the reshape function.

02:39.140 --> 02:50.940
The reshape function is very important because we convert the 1D array into a 2D array with one column.

02:50.940 --> 02:54.100
So here we are reshaping our data.

02:54.100 --> 02:55.820
This is a 1D array.

02:55.860 --> 03:00.540
I need to create it as a 2D array with one column.

03:00.700 --> 03:12.620
Okay so this is our reshaping process I'm converting 1D array into 2D array and making the data ready

03:12.660 --> 03:14.060
for TensorFlow.

03:14.180 --> 03:22.020
Again guys, reshaping is essential because machine learning algorithms expect features to be in 2D

03:22.060 --> 03:22.580
format.

03:22.580 --> 03:28.540
So I need to, uh, to pass features into the format.

03:28.540 --> 03:35.260
I don't need to pass arrays with 1D, I need arrays with 2D dimensions.

03:35.300 --> 03:39.450
Okay, so this is how we do reshaping.

03:39.490 --> 03:42.570
I'm converting this array.

03:42.970 --> 03:45.130
I'm accessing the size array.

03:45.370 --> 03:52.450
Getting the values and then reshaping them with one column and 2D array.

03:52.690 --> 03:53.250
Okay.

03:53.530 --> 03:55.610
So this is the magic.

03:55.810 --> 03:59.570
And by the way this is a very important thing.

03:59.810 --> 04:02.810
Then what is minus one.

04:02.850 --> 04:09.090
Minus one means automatically calculates this dimension.

04:09.090 --> 04:14.370
And one makes this dimension have one column.

04:14.410 --> 04:14.970
Okay.

04:15.170 --> 04:20.330
So minus one automatically calculate this dimension.

04:20.530 --> 04:24.690
And one makes this dimension have one column.

04:24.730 --> 04:25.250
Okay.

04:25.490 --> 04:32.330
So take whatever number of rows we have and make it one column.

04:32.610 --> 04:38.730
This is what we are what we told the reshape function.

04:38.770 --> 04:44.130
This is the reshaping process and it works fine.
