Now that we've covered the fundamental ideas behind artificial neurons, network structures, and how they learn through supervised methods, the next logical step is to consider how we actually build and train these networks in practice. Manually implementing the mathematics of forward and backward propagation for anything beyond a trivial network quickly becomes complex and error-prone. This is where deep learning frameworks come into play, providing high-level building blocks and optimized operations. Among the most popular and user-friendly frameworks is Keras.
Keras is a high-level API (Application Programming Interface) for neural networks. Think of it as a specification or a user-friendly control panel for defining, training, and evaluating deep learning models. It focuses on developer experience, allowing you to build sophisticated models with relatively few lines of code. Keras was designed with guiding principles that make it particularly well-suited for both learning deep learning concepts and building real-world applications:
An important aspect to understand is that Keras itself doesn't perform the low-level tensor operations (like matrix multiplications and gradient calculations) directly. Instead, it acts as an interface that relies on an underlying backend engine for these optimized computations.
Historically, Keras was closely associated with TensorFlow. However, starting with Keras 3, the framework has become truly multi-backend. This means you can write your Keras code once and choose to run it on different optimized tensor libraries:
Keras acts as a high-level interface, allowing you to choose an underlying backend (PyTorch, TensorFlow, or JAX) for numerical computation.
For this course, we will primarily use Keras 3 with the PyTorch backend. This choice reflects PyTorch's increasing adoption, particularly in research, and its often-praised developer experience. However, the beauty of Keras 3 is that most of the code you write will be portable across backends with minimal or no changes, giving you valuable flexibility.
Keras offers several advantages, especially when you are learning and building standard deep learning models:
Typically, using Keras involves these steps:
fit()
method (covered in Chapter 3).Keras provides clear, high-level functions for each of these steps, abstracting away much of the underlying complexity.
With this understanding of what Keras is and why it's a valuable tool for deep learning, the next step is to ensure you have it installed and ready to use. The following section will guide you through setting up your Python environment with TensorFlow (which includes Keras 3 by default) or setting up Keras with a PyTorch backend.
© 2025 ApX Machine Learning