Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Using Keras

00:00 Keras is a high-level neural networks API written in Python. It runs on top of deep learning frameworks like TensorFlow, and it was designed to enable fast experimentation with deep neural networks.

00:14 Let’s try to understand Keras with an analogy. Imagine you want to make a delicious cake. The cake represents the final machine learning model you want to build.

00:25 Keras is like a collection of cake mixes and decorations. It simplifies the process of making a cake or building a machine learning model, and you don’t need to mix all the ingredients from scratch.

00:36 Keras provides you with ready-to-use components.

00:39 TensorFlow is the kitchen where you’re going to make your cake. It provides all the tools and equipment like ovens, mixers needed to put your cake or machine learning model together,

00:51 and most cakes have layers, right? Think of each layer in a cake as a layer in a neural network. Just like a cake can have different layers like sponge, fruit, or cream.

01:02 A neural network can have different layers to process data in different ways. Each layer in a neural network, like in a cake, has a specific role and adds its unique flavor or characteristics to the overall outcome.

01:17 So, Keras makes the job easier and more efficient.

01:21 Let’s understand the scale of this efficiency better. Let’s try creating a very simple linear neural network. The code on the left is pure TensorFlow without using Keras, and the one on the right is the same exact model, but with Keras.

01:37 Look at the code snippet on the left. You have to define the layers of your model. In this case, a dense layer with 10 input features and one dense layer, which will return the output.

01:47 Then you’d have to define a method that would actually call your model. Then you’ll have to define your optimizer and loss function, and finally, create a whole custom training loop to train your model.

01:59 That’s quite a lot of work with Keras. You’d already have a lot of the steps covered. No need for a custom model class or a training loop, Keras has your back.

02:10 Look at the code on the right.

Become a Member to join the conversation.