- Firstly, let's initialize the random number generator to a constant seed value for reproducibility of results:
numpy.random.seed(0)
- Keras sequential layers are stacked so that every layer transfers its output to the next layer without defining additional data; let's import Sequential from the models:
# create sequential modelmodel = Sequential()
- To improve the efficiency and the convergence of the algorithm, we normalize the data based on the fact that the maximum pixel value is 255, so we divide all the pixels by 255 to obtain results between 0 and 1:
# normalize the datasetXTrain = XTrain / 255XTest = XTest / 255
- Exploring the data is an important aspect for choosing the right algorithm and getting the accuracy metric we ...