On Wednesday, 12 October 2016 13:58:41 BST Gokula Krishnan wrote:
> Hey,
> I am new to Keras and I found that there are basically two ways to define
> and train a model in Keras. The Sequential model and the Functional API.
I am not going to answer your questions one by one. The Functional API was designed to make it easier to build neural network models that are non-sequential, as most of the NN research was pointing in that direction, for example Residual Networks and Siamese networks, or just networks with multiple inputs and/or outputs.
The old Graph API could do that but it was pretty cumbersome to use, as you had to name each node and refer to it by name. The Functional API makes it pretty easy to build complex models, and it also has advantages as you can make networks and use them as modules to build a more complex model.
So basically you use the sequential model if your model is simple and basically just a sequence of layers, and you use the Functional API to make more complex models, which includes non-sequential connections and multiple inputs/outputs.
To what Matías said I would add the recommendation to always use the functional form,even for purely sequential models. It is only slightly more verbose, and you can more easily adapt to multiple branches, inputs, or outputs.
--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/9299384.Em7hHoWVxi%40vsd-grey-wolf.
For more options, visit https://groups.google.com/d/optout.