Complete the code to compile the TensorFlow model with the Adam optimizer.
model.compile(optimizer=[1], loss='sparse_categorical_crossentropy', metrics=['accuracy'])
The Adam optimizer is commonly used for training deep learning models because it adapts the learning rate during training.
Complete the code to train the model for 10 epochs on the training data.
history = model.fit(x_train, y_train, epochs=[1])Training for 10 epochs means the model will see the entire training data 10 times.
Fix the error in the code by completing the batch size parameter correctly.
history = model.fit(x_train, y_train, epochs=5, batch_size=[1])
Batch size should be an integer, not a string. It defines how many samples the model sees before updating weights.
Fill both blanks to evaluate the model on test data and print the accuracy.
loss, [1] = model.evaluate(x_test, y_test) print('Test accuracy:', [2])
The evaluate method returns loss and accuracy. We assign accuracy to a variable and print it.
Fill all three blanks to compile the model with RMSprop optimizer, mean squared error loss, and track mean absolute error metric.
model.compile(optimizer=[1], loss=[2], metrics=[[3]])
This setup uses RMSprop optimizer, mean squared error loss for regression, and tracks mean absolute error as a metric.
