Please go through the following exercises and answer all questions carefully. This is the only way (by making exercises, via trial and error, and with a lot of struggle) you will be able to master the framework and become an expert:
- Define a classifier using the Sequential, Functional, and Subclassing APIs so that you can classify the fashion-MNIST dataset.
- Train the model using the Keras model's built-in methods and measure the prediction accuracy.
- Write a class that accepts a Keras model in its constructor and that it trains and evaluates.
The API should work as follows:
# Define your model
trainer = Trainer(model)
# Get features and labels as numpy arrays (explore the dataset available in the keras module)
trainer.train(features, labels)
# measure the accuracy
trainer.evaluate(test_features, test_labels)
- Accelerate the training method using the @tf.function annotation...