Skip to main content

Keras Model

Try Databricks for free

What is a Keras Model?

Keras is a high-level library for deep learning, built on top of Theano and Tensorflow. It is written in Python and provides a clean and convenient way to create a range of deep learning models. Keras has become one of the most used high-level neural networks APIs when it comes to developing and testing neural networks. Creating layers for neural networks as well as setting up complex architectures are now a breeze due to the Keras high-level API. A Keras model is made up of a sequence or a standalone graph. There are several fully configurable modules that can be combined to create new models. Some of these configurable modules that you can plug together are neural layers, cost functions, optimizers, initialization schemes, dropout, loss,  activation functions, and regularization schemes. One of the main advantages that come with modularity is that you can easily add new features as separate modules. As a result, Keras is very flexible and well-suited for innovative research. There are two ways you can develop a Keras model: sequential and functional. Keras Models

Sequential API Mode

The Sequential API model is the simplest model and it comprises a linear pile of layers that allows you to configure models layer-by-layer for most problems. The sequential model is very simple to use, however, it is limited in its topology. The limitation comes from the fact that you are not able to configure models with shared layers or have multiple inputs or outputs.

Functional API

Alternatively, the Functional API is ideal for creating complex models, that require extended flexibility. It allows you to define models that feature layers connect to more than just the previous and next layers. Models are defined by creating instances of layers and connecting them directly to each other in pairs, Actually, with this model you can connect layers to any other layer. With this model creating complex networks such as siamese networks, residual networks, multi-input/multi-output models, directed acyclic graphs (DAGs), and models with shared layers becomes possible.  

Additional Resources

Back to Glossary