You are previewing Getting Started with TensorFlow.
O'Reilly logo
Getting Started with TensorFlow

Book Description

Get up and running with the latest numerical computing library by Google and dive deeper into your data!

About This Book

  • Get the first book on the market that shows you the key aspects TensorFlow, how it works, and how to use it for the second generation of machine learning

  • Want to perform faster and more accurate computations in the field of data science? This book will acquaint you with an all-new refreshing library—TensorFlow!

  • Dive into the next generation of numerical computing and get the most out of your data with this quick guide

  • Who This Book Is For

    This book is dedicated to all the machine learning and deep learning enthusiasts, data scientists, researchers, and even students who want to perform more accurate, fast machine learning operations with TensorFlow. Those with basic knowledge of programming (Python and C/C++) and math concepts who want to be introduced to the topics of machine learning will find this book useful.

    What You Will Learn

  • Install and adopt TensorFlow in your Python environment to solve mathematical problems

  • Get to know the basic machine and deep learning concepts

  • Train and test neural networks to fit your data model

  • Make predictions using regression algorithms

  • Analyze your data with a clustering procedure

  • Develop algorithms for clustering and data classification

  • Use GPU computing to analyze big data

  • In Detail

    Google's TensorFlow engine, after much fanfare, has evolved in to a robust, user-friendly, and customizable, application-grade software library of machine learning (ML) code for numerical computation and neural networks.

    This book takes you through the practical software implementation of various machine learning techniques with TensorFlow. In the first few chapters, you'll gain familiarity with the framework and perform the mathematical operations required for data analysis. As you progress further, you'll learn to implement various machine learning techniques such as classification, clustering, neural networks, and deep learning through practical examples.

    By the end of this book, you’ll have gained hands-on experience of using TensorFlow and building classification, image recognition systems, language processing, and information retrieving systems for your application.

    Style and approach

    Get quickly up and running with TensorFlow using this fast-paced guide. You will get to know everything that can be done with TensorFlow and we'll show you how to implement it in your environment. The examples in the book are from the core of the computation industry—something you can connect to and will find familiar.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Getting Started with TensorFlow
      1. Getting Started with TensorFlow
      2. Credits
      3. About the Author
      4. About the Reviewer
        1. eBooks, discount offers, and more
          1. Why subscribe?
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      7. 1. TensorFlow – Basic Concepts
        1. Machine learning and deep learning basics
          1. Supervised learning
            1. Unsupervised learning
            2. Deep learning
        2. TensorFlow – A general overview
        3. Python basics
          1. Syntax
          2. Data types
          3. Strings
          4. Control flow
          5. Functions
          6. Classes
          7. Exceptions
          8. Importing a library
        4. Installing TensorFlow
          1. Installing on Mac or Linux distributions
          2. Installing on Windows
          3. Installation from source
          4. Testing your TensorFlow installation
        5. First working session
        6. Data Flow Graphs
        7. TensorFlow programming model
          1. How to use TensorBoard
        8. Summary
      8. 2. Doing Math with TensorFlow
        1. The tensor data structure
          1. One-dimensional tensors
          2. Two-dimensional tensors
            1. Tensor handling
          3. Three-dimensional tensors
          4. Handling tensors with TensorFlow
            1. Prepare the input data
        2. Complex numbers and fractals
          1. Prepare the data for Mandelbrot set
          2. Build and execute the Data Flow Graph for Mandelbrot's set
          3. Visualize the result for Mandelbrot's set
          4. Prepare the data for Julia's set
          5. Build and execute the Data Flow Graph for Julia's set
          6. Visualize the result
        3. Computing gradients
        4. Random numbers
          1. Uniform distribution
          2. Normal distribution
          3. Generating random numbers with seeds
            1. Montecarlo's method
        5. Solving partial differential equations
          1. Initial condition
          2. Model building
          3. Graph execution
            1. Computational function used
        6. Summary
      9. 3. Starting with Machine Learning
        1. The linear regression algorithm
          1. Data model
            1. Cost functions and gradient descent
              1. Testing the model
        2. The MNIST dataset
          1. Downloading and preparing the data
        3. Classifiers
          1. The nearest neighbor algorithm
            1. Building the training set
            2. Cost function and optimization
              1. Testing and algorithm evaluation
        4. Data clustering
          1. The k-means algorithm
          2. Building the training set
          3. Cost functions and optimization
            1. Testing and algorithm evaluation
        5. Summary
      10. 4. Introducing Neural Networks
        1. What are artificial neural networks?
          1. Neural network architectures
        2. Single Layer Perceptron
        3. The logistic regression
          1. TensorFlow implementation
          2. Building the model
          3. Launch the session
          4. Test evaluation
          5. Source code
        4. Multi Layer Perceptron
          1. Multi Layer Perceptron classification
            1. Build the model
            2. Launch the session
            3. Source code
          2. Multi Layer Perceptron function approximation
            1. Build the model
            2. Launch the session
        5. Summary
      11. 5. Deep Learning
        1. Deep learning techniques
          1. Convolutional neural networks
            1. CNN architecture
            2. TensorFlow implementation of a CNN
              1. Initialization step
              2. First convolutional layer
              3. Second convolutional layer
              4. Densely connected layer
              5. Readout layer
              6. Testing and training the model
              7. Launching the session
              8. Source code
          2. Recurrent neural networks
            1. RNN architecture
            2. LSTM networks
            3. NLP with TensorFlow
              1. Download the data
          3. Building the model
          4. Running the code
        2. Summary
      12. 6. GPU Programming and Serving with TensorFlow
        1. GPU programming
        2. TensorFlow Serving
          1. How to install TensorFlow Serving
            1. Bazel
            2. gRPC
              1. TensorFlow serving dependencies
              2. Install Serving
          2. How to use TensorFlow Serving
            1. Training and exporting the TensorFlow model
            2. Running a session
        3. Loading and exporting a TensorFlow model
          1. Test the server
        4. Summary