3 Introduction to Keras and TensorFlow

 

This chapter covers:

  • A closer look at TensorFlow, Keras, and their relationship
  • Setting up a deep-learning workspace
  • An overview of how core deep learning concepts translate to Keras and TensorFlow

This chapter is meant to give you everything you need to start doing deep learning in practice. We’ll give you a quick presentation of Keras (keras.io) and TensorFlow (tensorflow.org), the Python-based deep-learning tools that we’ll use throughout the book. You’ll find out how to set up a deep-learning workspace, with TensorFlow, Keras, and GPU support. Finally, building on top of the first contact you’ve had with Keras and TensorFlow in chapter 2, we’ll review the core components of neural networks and how they translate to the Keras and TensorFlow APIs.

By the end of this chapter, you’ll be ready to move on to practical, real-world applications — which will start with chapter 4.

3.1  What’s TensorFlow?

TensorFlow is a Python-based, free, open-source machine learning platform, developed primarily by Google. Much like NumPy, the primary purpose of TensorFlow is to enable engineers and researchers to manipulate mathematical expressions over numerical tensors. But TensorFlow goes far beyond the scope of NumPy in the following ways:

3.2  What’s Keras?

3.3  Keras and TensorFlow: a brief history

3.4  Setting up a deep-learning workspace

3.4.1  Jupyter notebooks: the preferred way to run deep-learning experiments

3.4.2  Using Colaboratory

3.5  First steps with TensorFlow

3.5.1  Constant tensors and Variables

3.5.2  Tensor operations: doing math in TensorFlow

3.5.3  A second look at the GradientTape API

3.5.4  An end-to-end example: a linear classifier in pure TensorFlow

3.6  Anatomy of a neural network: understanding core Keras APIs

3.6.1  Layers: the building blocks of deep learning

3.6.2  From layers to models

3.6.3  The "compile" step: configuring the learning process

3.6.4  Picking a loss function

3.6.5  Understanding the "fit" method

3.7  Chapter summary

sitemap