Menu

Compiling the CNN Model

Compiling the CNN Model

Compile the CNN before training.

Code

cnn.compile(
optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy']
)

Explanation

The CNN uses the Adam optimizer, which generally provides faster convergence than traditional gradient descent methods.