Machine Learning & AI

keras

Neural networks with training wheels, built by the researcher who now helps shape where AI is headed.

Install it: pip install keras

What does it do?

Keras is the friendly front door to deep learning: instead of writing dozens of lines of low-level math to define a neural network layer by layer, you describe your network almost like stacking building blocks. Underneath, it hands the heavy computation off to a more complex engine, originally TensorFlow, now also PyTorch or JAX, so you get power without needing to understand every mechanical detail. It was designed explicitly to cut the number of decisions a beginner has to make just to get a working model. Think of it as the automatic transmission version of deep learning, versus the manual stick-shift of writing raw TensorFlow or PyTorch code.

See it in action

This code stacks together a simple neural network, then trains it on made-up practice numbers so it learns to predict an output value.

import keras
import numpy as np
from keras import layers

model = keras.Sequential([
    layers.Dense(64, activation="relu", input_shape=(10,)),
    layers.Dense(1)
])
model.compile(optimizer="adam", loss="mse")

x_train = np.random.rand(100, 10)
y_train = np.random.rand(100, 1)
model.fit(x_train, y_train, epochs=5)

Why would a non-developer care?

It dramatically lowered the bar to experimenting with neural networks, letting far more people, students, hobbyists, smaller companies, try deep learning without a PhD’s worth of linear algebra first. That accessibility helped seed a much wider pool of people who eventually became professional AI practitioners.

Real-world examples

Keras is baked directly into TensorFlow as its official high-level interface, meaning millions of TensorFlow tutorials online are effectively Keras tutorials. Many introductory deep learning courses, including well-known university and online offerings, teach Keras first precisely because it hides the intimidating parts.

Who uses it

Beginners learning deep learning, and engineers who want to prototype a neural network quickly before optimizing it in raw TensorFlow or PyTorch.

How it compares to alternatives

Keras isn’t really a competitor to TensorFlow or PyTorch, it’s a simplified layer that sits on top of them. Compared to writing raw PyTorch or TensorFlow code, Keras trades some flexibility for a much gentler learning curve.

Fun fact

Keras was created by Google engineer and AI researcher Francois Chollet, who named it after the Greek word for horn, a reference to a line in Homer’s Odyssey about dreams that come true passing through a gate of horn.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries