In this section, we will learn three major types of tf.keras APIs to define neural network layers, namely the following:
- Sequential APIs: These are based on stacking NN layers, which could be either dense (feedforward), convolutional, or recurrent layers)
- Functional APIs: These help to build complex models
- Model subclassing APIs: These are fully customizable models; these APIs are flexible and require care to write
The following diagram shows a Python class hierarchy for these three APIs to build tf.keras.Model:
Let's create a relatively simple neural network to build a handwriting recognition classifier using MNIST data. We will use this example to demonstrate all three sets of APIs.
MNIST data contains 50,000 training datasets and 10,000 test datasets. These datasets have images of numerical digits and they are labeled to 10 classes...