What is Keras? (original) (raw)

Last Updated : 9 Jun, 2026

Keras is a deep learning API that simplifies the process of building deep neural networks. Initially it was developed as an independent library, Keras is now tightly integrated into TensorFlow as its official high-level API. It supports multiple backend engines like TensorFlow, Theano and Microsoft Cognitive Toolkit (CNTK). Keras makes it easier to train and evaluate deep learning models without requiring extensive knowledge of low-level operations.

**Installing Keras

1. Since Keras is now part of TensorFlow, it can be installed easily using pip:

Python `

pip install tensorflow

`

This command installs TensorFlow 2.x, which includes Keras.

2. To check the installation, open Python and run:

Python `

import tensorflow as tf print('TensorFlow Version: ', tf.version) print('Keras Version ', tf.keras.version)

`

**Output:

TensorFlow Version: 2.18.0
Keras Version 3.8.0

History of Keras

Keras was developed by Google engineer named François Chollet. It was developed as part of research project called ONEIROS (Open-ended Neuro-Electronic Intelligent Robot Operating System) and it was released in March 2015.

The goal of Keras was to enable experimentation with deep neural networks. Later, Keras was tagged into TensorFlow as 'tf.keras', which made it an official high-level API of TensorFlow while having its own version that could interface with other computational backends like Theano or CNTK.

Key Features of Keras Library

**Aspect **Key Points
**Simplicity High-level API for the full ML workflow and reduces manual effort with clear, productive interfaces.
**Customizability Easily extendable with custom layers, losses and preprocessing, It supports both functional API and low-level model building.
**Compatibility Runs on TensorFlow, Theano and CNTK allowing consistent performance across CPU and GPU platforms.
**Scalability and Performance Uses scalable backends like TensorFlow
**Fast Experimentation Uses simple tools to build models quickly, making it great for research and testing

How to Build a Model in Keras?

Keras provides two main ways to build models:

1. Building Model using Sequential API

The Sequential API are easy to work with models with a single input and output and a linear stack of layers

Here’s how you can define a Sequential model:

from keras.models import Sequential from keras.layers import Dense, Activation

model = Sequential() model.add(Dense(units=64, input_dim=100)) model.add(Activation('relu')) model.add(Dense(units=10)) model.add(Activation('softmax'))

`

2. Building Model using Functional API

Functional API allows more flexibility in creating complex architectures. You can create models with shared layers, multiple inputs/outputs and skip connections.

**For example:

from keras.layers import Input, Dense, concatenate from keras.models import Model

input1 = Input(shape=(100,)) input2 = Input(shape=(50,)) hidden1 = Dense(64, activation='relu')(input1) hidden2 = Dense(32, activation='relu')(input2) merged = concatenate([hidden1, hidden2]) output = Dense(10, activation='softmax')(merged)

model = Model(inputs=[input1, input2], outputs=output)

`

Applications