The Keras Python Library makes creating deep learning models fast and easy.
The sequential API allows you to create models Layer-by-layer for most problems. It is limited the it does not allow the to create models that share layers or have multiple inputs or outputs.
The functional API in Keras is a alternate way of creating models, offers a lot flexibility more complex models.
In this tutorial, you'll discover how to use the more flexible functional API in Keras to define deep learning.
After completing this tutorial, you'll know:the difference between the sequential and functional APIs. How to define simple multilayer perceptron, convolutional neural network, and recurrent neural network using the FU Nctional API. How to define more complex models with shared layers and multiple inputs and outputs.
Let ' s get started. Tutorial Overview
This tutorial was divided into 6 parts; They are:keras sequential Models keras functional Models-Standard network Models Shared Layers Model multiple Input and O Utput Models Best Practices 1. Keras Sequential Models
As a review, Keras provides a sequential model API.
This is a way of creating deep learning models where a instance to the sequential class is created and model layers are C Reated and added to it.
For example, the layers can is defined and passed to the sequential as a array:
1 2 3 |
From Keras. Models import sequential from Keras. Layers Import Dense model = sequential ([Dense (2, Input_dim = 1), dense (1)]) |
Layers can also be added piecewise:
1 2 3 4 5 |
from Keras. Models import sequential |
/table>