May 2020
Intermediate to advanced
404 pages
10h 52m
English
We are now ready to compile and train the neural network. To compile the neural network, we use the following code:
model.compile(loss=keras.losses.categorical_crossentropy, optimizer=keras.optimizers.Adam(), metrics=['accuracy'])
In our model, which we compiled in the previous block of code, we have set categorical cross-entropy as the loss function; the optimizer function used is the Adam optimizer and the metric for evaluation is accuracy.
We then train the neural network with the fit() method of the Keras model object:
model.fit(x_train, y_train, batch_size=100, epochs=10, verbose=2, validation_split=0.2)
Read now
Unlock full access