Welcome back.
We generated this table having two columns size and price.
Now we need to introduce something called reshaping data.
Our current data is a combined and concatenated array.
This is the form of our data.
And we use it to make this table and plot.
If we if we need to plot on a graph using Matplot library.
But here we need to send our data to TensorFlow in order to process it, and later for training our
model.
So we're going to do something called reshaping data.
Reshaping is essential because machine learning algorithms expect features to be in a 2D format, where
each row is a sample and each column is a feature.
Please pay attention to this.
Each row is a sample and each column is a feature.
Before we have a 1D array 1.5, 2.02.5.
After we have a 2D array 1.5, 2.0 and 2.5, and the others are filled with other columns.
So we need to transform 1D array.
Or we we need to combine the 1D arrays into two d array.
Okay.
So here we are going to prepare the data for TensorFlow.
Start with x equals to data the data that we created before.
So we are referring to those data.
We need to access from this data the size.
So get the column and pay attention for the name of the column because it's case sensitive.values.re
shape.
This is the function that we're going to use.
And I'll use minus one.
The first parameter and the second parameter is one.
Also we're going to create a variable called y.
And here y equals to Data price.
I'm accessing this column.
Price values dot reshape and again passing minus one and one.
Now let's learn about the reshape function.
The reshape function is very important because we convert the 1D array into a 2D array with one column.
So here we are reshaping our data.
This is a 1D array.
I need to create it as a 2D array with one column.
Okay so this is our reshaping process I'm converting 1D array into 2D array and making the data ready
for TensorFlow.
Again guys, reshaping is essential because machine learning algorithms expect features to be in 2D
format.
So I need to, uh, to pass features into the format.
I don't need to pass arrays with 1D, I need arrays with 2D dimensions.
Okay, so this is how we do reshaping.
I'm converting this array.
I'm accessing the size array.
Getting the values and then reshaping them with one column and 2D array.
Okay.
So this is the magic.
And by the way this is a very important thing.
Then what is minus one.
Minus one means automatically calculates this dimension.
And one makes this dimension have one column.
Okay.
So minus one automatically calculate this dimension.
And one makes this dimension have one column.
Okay.
So take whatever number of rows we have and make it one column.
This is what we are what we told the reshape function.
This is the reshaping process and it works fine.