Neural Network Models in Keras
Neural network models in Keras are defined as the graph of layers. The models in Keras can be created using the sequential or the functional APIs. Both the functional and sequential APIs can be used to build any kind of models. The functional API makes it easier to build the complex models that have multiple inputs, multiple outputs and shared layers.
Thus as a rule of thumb, we have seen engineers use the sequential API for simple models built from simple layers and the functional API for complex models involving branches and sharing of layers. We have also observed that building simple models with the functional API makes it easier to grow the models into complex models with branching and sharing. Hence for our work, we always use the functional API.
Workflow for building models in Keras
The simple workflow in Keras is as follows:
- Create the model
- Create and add layers to the model
- Compile the model
- Train the model
- Use the model for prediction or evaluation
Let's...