TensorFlow for Machine Intelligence
Copyright (c) 2016 Bleeding Edge Press
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher.
This book expresses the authors views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Bleeding Edge Press, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
ISBN: 978-1-939902-35-1
Published by: Bleeding Edge Press, Santa Rosa, CA 95404
Title: TensorFlow for Machine Intelligence
Authors: Sam Abrahams, Danijar Hafner, Erik Erwitt, Ariel Scarpinelli
Acquisitions Editor: Christina Rudloff
Editor: Troy Mott
Cover Designer: Martin Murtonen
Website: bleedingedgepress.com
Preface
Welcome
Since its open source release in November 2015,TensorFlow has become one of the mostexciting machine learning libraries available. It is being used more andmore in research, production, and education. The library has seencontinual improvements, additions, and optimizations, and the TensorFlowcommunity has grown dramatically. With TensorFlow for Machine Intelligence, we hope to help new and experienced users hone theirabilities with TensorFlow and become fluent in using this powerfullibrary to its fullest!
Background education
While this book is primarily focused on the TensorFlow API, we expectyou to have familiarity with a number of mathematical andprogrammatic concepts. These include:
- Derivative calculus (single-variable and multi-variables)
- Matrix algebra (matrix multiplication especially)
- Basic understanding of programming principles
- Basic machine learning concepts
In addition to the above, you will get more out ofthis book if they have the following knowledge:
- Experience with Python and organizing modules
- Experience with the NumPy library
- Experience with the matplotlib library
- Knowledge of more advanced machine learning concepts, especiallyfeed-forward neural networks, convolutional neural networks, andrecurrent neural networks
When appropriate, well include refresher information to re-familiarizethe reader with some of the concepts they need to know, to fullyunderstand the math and/or Python concepts.
What you should expect to learn
This TensorFlow book introduces the framework and the underlying machine learning concepts that are important to harness machine intelligence.
After reading this book, you should know the following:
- A deep understanding of the core TensorFlow API
- The TensorFlow workflow: graph definition and graph execution
- How to install TensorFlow on various devices
- Best practices for structuring your code and project
- How to create core machine learning models in TensorFlow
- How to implement RNNs and CNNs in TensorFlow
- How to deploy code with TensorFlow Serving
- The fundamentals of utilizing TensorBoard to analyze your models
This books layout
Section 1: Getting started with TensorFlow
The first section of this book helps get you on your feet and ready to use TensorFlow. The first chapter is the introduction, which provides a brief historical context for TensorFlow and includes a discussion about TensorFlows design patterns as well as the merits and challenges of choosing TensorFlow as a deep learning library.
After the introduction, TensorFlow Installation goes over some considerations a person installing TensorFlow should think about, and includes detailed instructions on installing TensorFlow: both installing from binaries as well as building from source.
Section 2: TensorFlow and Machine Learning fundamentals
This second section begins in Fundamentals of TensorFlow by getting TensorFlowinstalled on your machine and diving deep into the fundamentals of theTensorFlow API without incorporating a lot of machine learningconcepts. The goal is to isolate learning TensorFlow and learning howto do machine learning with TensorFlow. This will include an in depthdescription of many of the most important pieces of the TensorFlow API. Well also show how you can take a visual graph representationof a model and translate it into TensorFlow code, as well as verify thatthe graph is modeled correctly by using TensorBoard.
Once the core API concepts are covered, we continue with MachineLearning Basics, in which we create simple machine learning models,such as linear regression, logistic regression, and clustering, insideof TensorFlow.
Section 3: Implementing advanced deep models in TensorFlow
The third section is comprised of two chapters, each focusing on adifferent type of more complex deep learning model. Each will describe themodel in question and present visual graph representation of what we aretrying to create. Well discuss why the model is setup the way it is,note any mathematical quirks, and then go over how to set them upeffectively in TensorFlow.
The first model well look at is the Convolutional Neural Network, orCNN, in Object Recognition and Classification, where well talk abouttraining TensorFlow models on image data. This will include a discussionon the math and purpose of convolutions, how to convert raw image datainto a TensorFlow-compatible format, and how to test your final output.
In the chapter Natual Language Processing with Reurrent Networks,well examine how to properly create Recurrent Neural Networks, or RNNs,in TensorFlow. Looking at a variety of natural language processing (NLP)tasks, well see how to use Long Short-Term Memory (networks) andincorporate pre-trained word vectors in your model.
Section 4: Additional tips, techniques, and features
The final section of the book will explore the latest features availablein the TensorFlow API. Topics include preparing your model for deployment, useful programming patterns, and other select subjects.
Other machine learning libraries
TensorFlow is not the only open source machine learning library outthere. Below is a short list of various options for deeplearning:
- Caffe focuses on convolutionalneural networks and image processing, and is written in C++.
- Chainer is another flexible machine learningPython library capable of utilizing multiple GPUs on one machine.
- CNTK is Microsofts entry into theopen source machine learning library game. It uses its own modeldefinition language to build distributed models declaratively.
- Deeplearning4j is a Java libraryspecifically focused on neural networks. It is built to be scaled andintegrated with Spark, Hadoop, and other Java-based distributedsoftware.
- Nervana Neon is an efficientPython machine learning library, which is capable of using multipleGPUs on a single machine.
- Theano is an extremelyflexible Python machine learning library written in Python. It ispopular in research, as it is quite user friendly and capable ofdefining complex models fairly easily. TensorFlows API is most similarto Theanos.
- Torch is a machine learning library that focuses onGPU implementation. It is written in Lua, and is backed by researchteams at several large companies.
Its beyond the scope of this book to have an in-depth discussion on themerits of each of these libraries, but it is worth looking into them ifyou have the time. The authors of TensorFlow took inspiration fromseveral of them when designing the framework.