Member-only story

Techniques to Build Models in Keras

Build deep learning model in Keras using Sequential, Functional Keras API, and Model Subclassing

Renu Khandelwal
5 min readSep 16, 2021

If you are creating machine learning models using Keras, know all the available techniques to build a model, their strengths, and when to apply them along with the code.

Keras Sequential Model

Sequential is the most common and simple technique to build models in Keras.

Sequential groups a linear stack of layers into a Keras Model. The Sequential model is built by passing a list of layers to the Sequential constructor

When to build Sequential models in Keras?

Sequential Models are appropriate for a plain stack of layers with exactly one input tensor and one output tensor like VGGNet.

When to avoid building a Sequential model?

You cannot use the Sequential model when

  • The model has multiple inputs or multiple outputs. Use Functional API or Model Subclassing to create models with multiple inputs or multiple outputs.
  • The intermediate layers in the model have multiple inputs or outputs like in ResNet.
  • There are share layers within the model.
  • The sequential model builds only linear topology, hence not

--

--

Renu Khandelwal
Renu Khandelwal

Written by Renu Khandelwal

A Technology Enthusiast who constantly seeks out new challenges by exploring cutting-edge technologies to make the world a better place!

No responses yet