‫Now, we have a fairly good idea about our X and Y variables, our X variable is present in the form
‫of 2D array of 28 into 28 pixel intensities, where each individual pixel intensity lies between zero
‫and 255.
‫And since we are going to use gradient descent to compile our model, we need to normalize this pixel
‫intensities.
‫By normalizing, I mean, we have to restrict this pixel intensities between zero and one.
‫A very simple way to do this is by dividing all the pixel intensities by 255.
‫So zero will remain zero and 255, which stands for completely white pixel becomes one.
‫And so on.
‫So to normalize, we can just divide our x train full data set by 255.
‫And similarly, we have to normalize our test data set as well.
‫So for tests also.
‫We are dividing all the pixel intensities by 255.
‫This normalization is different from the normalization we generally do for machine learning algorithms.
‫Since here, we know that all these values are on an absolute scale of zero to 255.
‫We can directly divide it by 255.
‫But for general machine learning databases, we don't know the absolute scale.
‫So we generally subtract the mean from these numbers and divide it by their standard deviations.
‫But that process is not needed here, since we know that the pixel intensities lies between zero and
‫255.
‫So here we can directly divide it by two fifty five.
‫And one thing you can notice is that we are not dividing it by 255.
‫We are dividing it by two fifty five point zero.
‫That because we want the final output in the form of floating numbers between zero and one. If we divided it
‫by just integer values of 255.
‫So since the intensities are integer value, there might be some cases with some Python version where
‫we get the output as integer since we want the whole greyscale between zero and one.
‫We have to use two fifty five point zero with recent Python version.
‫You don't have to do this but to make sure that the code is compatible with all other Python versions.
‫It's better to divide it with a floating number so that the final output is in the form of floating number
‫between zero and one.
‫Just create this.
‫We're calling our normalize data sets, as x underscore train underscore N and X underscore
‫tests underscore N.
‫As I told you earlier, our train dataset is of
‫Six thousand observations.
‫And our test dataset is of another 10000 observations.
‫We will further divide our train dataset into training and validation sets.
‫We will use the first 5000 observations as our validation test.
‫And next, fifty five thousand as our training dataset.
‫So to do that, we can just divide it using this simple operations.
‫We are saving our 0 to 5000 datasets into X validation.
‫And from 5001 to 60000.
‫Into x train, similarly, we have to do this for our y dataset.
‫Also, we are saving first 5000 observations into X validation.
‫And next 55000 observations.
‫Into y train.
‫And our X test will remain the same.
‫So we are just saving our normalized data into X test data.
‫So just run this.
‫Now we have three datasets.
‫First is the validation set of 5000.
‫Then the training set of 55000.
‫And then an another dataset of 10000 observations in our test dataset.
‫We will be using train dataset to train our model.
‫We will be using validation set to optimize the performance of automotive.
‫And then after tuning all the hyper parameters, we will be using test data set.
‫To evaluate the performance of our model.
‫To view the values of this dataset, you can just call the dataset.
‫You can see now the values are between zero and one.
‫Just look at the first value.
‫Here you can see there are some values which are between zero and one.
‫And now our data isnormalized. In the next lecture
‫We'll look at different methods that are available to create neural network using keras.
‫Thank you.