Using the Keras Sequential API
The main goal of Keras is to make it easy to create deep learning models. The Sequential API allows us to create Sequential models, which are a linear stack of layers. Models that are connected layer by layer can solve many problems. To create a Sequential model, we have to create an instance of a Sequential class, create some model layers, and add them to it.
We will go from the creation of our Sequential model to its prediction via the compilation, training, and evaluation steps. By the end of this recipe, you will have a Keras model ready to be deployed in production.
Getting ready
This recipe will cover the main ways of creating a Sequential model and assembling layers to build a model with the Keras Sequential API.
To start, we load TensorFlow and NumPy, as follows:
import tensorflow as tf
from tensorflow import keras
from keras.layers import Dense
import numpy as np
We are ready to proceed with an explanation of how...