Source: Deep Learning on Medium
Introduction to Keras — Deep Learning Library
What You Will Learn?
- Introduction to Keras
- Example Code, explaining Keras
Introduction to Keras
Keras is a deep learning framework for Python that provides a convenient way to define and train almost any kind of deep learning model. Keras is a high-level neural networks API, written in Python which is capable of running on top of Tensorflow, Theano and CNTK. It was developed for enabling fast experimentation.
Being able to go from idea to result with the least possible delay is key to doing good research.
Keras has the following features :
- Allows for easy and fast prototyping
- Run seamlessly on CPU and GPU
- Supports both convolutional networks(for computer vision) and recurrent networks(for sequence and time-series), as well as the combination of two.
- It supports arbitrary network architectures: multi-input or multi-output models, layer sharing, model sharing and so on. This means Keras is appropriate for building deep learning models, from generative adversarial networks to a neural Turing machine.
Keras is compatible with versions of Python from 2.7 to 3.6 till date.
Keras is used by around 200,000 users, ranging from academic researchers and engineers at both startups and large companies to graduate students and hobbyist. Keras is used at Google, Netflix, Uber, Microsoft, Square and many startups working on the wide variety of machine learning problems.
Keras recommend users to switch to tf.keras in Tensorflow 2.0, who use multi-backend keras with the tensorflow backend.
- User Friendliness
- Easy Extensibility
- Work with Python
Keras doesn’t handle low-level operations such as tensor manipulations and differentiation. Instead, it relies on a specialized, well-optimized tensor library to do so which serves as the backend engine of Keras. We can use several backend engine for keras, and currently three existing backend implementations are the Tensorflow backend, the Theano backend, and the Microsoft Cognitive Toolkit (CNTK) backend.
Example Code, explaining Keras
pip install keras
The typical Keras workflows looks like:
- Define your training data: input tensor and target tensor
- Define a network of layers(or model ) that maps input to our targets.
- Configure the learning process by choosing a loss function, an optimizer, and some metrics to monitor.
- Iterate your training data by calling the fit() method of your model.
You can define your model in two ways :
- Sequential Class: Linear Stack of layers
- Functional API: Directed acyclic graphs of layers
Implementing Loss Functiom, Optimizer and Metrics
Finally, passing input and target tensors
This is the basic overview of keras and we will be making more tutorials on keras. Want to learn about neural networks ? , check this article :