Getting Started with TensorFlow - Giancarlo Zaccone - E-Book

Getting Started with TensorFlow E-Book

Giancarlo Zaccone

0,0
29,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 142

Veröffentlichungsjahr: 2016

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

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

Getting Started with TensorFlow

Getting Started with TensorFlow

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: July 2016

Production reference: 1190716

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham 

B3 2PB, UK.

ISBN 978-1-78646-857-4

www.packtpub.com

Credits

Author

Giancarlo Zaccone

Copy Editor

Alpha Singh

Reviewer

Jayani Withanawasam

Project Coordinator

Shweta H Birwatkar

Commissioning Editor

Veena Pagare

Proofreader

Safis Editing

Acquisition Editor

Vinay Argekar

Indexer

Mariammal Chettiyar

Content Development Editor

Sumeet Sawant

Production Coordinator

Nilesh Mohite

Technical Editor

Deepti Tuscano

Cover Work

Nilesh Mohite

About the Author

Giancarlo Zaccone has more than 10 years of experience managing research projects in both the scientific and industrial domains. He worked as researcher at the C.N.R, the National Research Council, where he was involved in projects related to parallel numerical computing and scientific visualization.

Currently, he is a senior software engineer at a consulting company developing and maintaining software systems for space and defence applications.

Giancarlo holds a master's degree in physics from the Federico II of Naples and a 2nd level postgraduate master course in scientific computing from La Sapienza of Rome.

He has already been a Packt author for the following book: Python Parallel Programming Cookbook.

You can contact him at https://it.linkedin.com/in/giancarlozaccone

About the Reviewer

Jayani Withanawasam is a senior software engineer at Zaizi Asia - Research and Development team. She is the author of the book Apache Mahout Essentials, on scalable machine learning. She was a summit speaker at Alfresco Summit 2014 - London. Her talk was about applications of machine learning techniques in smart enterprise content management (ECM) solutions. She presented her research “Content Extraction and Context Inference based Information Retrieval” at the Women in Machine Learning (WiML) 2015 workshop, which was co-located with the Neural Information Processing Systems (NIPS) 2015 conference - Montreal, Canada.

Jayani is currently pursuing an MSc in Artificial Intelligence at the University of Moratuwa, Sri Lanka. She has strong research interests in machine learning and computer vision. 

You can contact her at https://lk.linkedin.com/in/jayaniwithanawasam

www.PacktPub.com

eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Preface

TensorFlow is an open source software library used to implement machine learning and deep learning systems.

Behind these two names are hidden a series of powerful algorithms that share a common challenge: to allow a computer to learn how to automatically recognize complex patterns and make the smartest decisions possible.

Machine learning algorithms are supervised or unsupervised; simplifying as much as possible, we can say that the biggest difference is that in supervised learning the programmer instructs the computer how to do something, whereas in unsupervised learning the computer will learn all by itself.

Deep learning is instead a new area of machine learning research that has been introduced with the objective of moving machine learning closer to artificial intelligence goals. This means that deep learning algorithms try to operate like the human brain.

With the aim of conducting research in these fascinating areas, the Google team developed TensorFlow, which is the subject of this book.

To introduce TensorFlow’s programming features, we have used the Python programming language. Python is fun and easy to use; it is a true general-purpose language and is quickly becoming a must-have tool in the arsenal of any self-respecting programmer.

It is not the aim of this book to completely describe all TensorFlow objects and methods; instead we will introduce the important system concepts and lead you up the learning curve as fast and efficiently as we can. Each chapter of the book presents a different aspect of TensorFlow, accompanied by several programming examples that reflect typical issues of machine and deep learning.

Although it is large and complex, TensorFlow is designed to be easy to use once you learn about its basic design and programming methodology.

The purpose of Getting Started with TensorFlow is to help you do just that.

Enjoy reading!

What this book covers

Chapter 1, TensorFlow – Basic Concepts, contains general information on the structure of TensorFlow and the issues for which it was developed. It also provides the basic programming guidelines for the Python language and a first TensorFlow working session after the installation procedure. The chapter ends with a description of TensorBoard, a powerful tool for optimization and debugging.

Chapter 2, Doing Math with TensorFlow, describes the ability of mathematical processing of TensorFlow. It covers programming examples on basic algebra up to partial differential equations. Also, the basic data structure in TensorFlow, the tensor, is explained.

Chapter 3, Starting with Machine Learning, introduces some machine learning models. We start to implement the linear regression algorithm, which is concerned with modeling relationships between data. The main focus of the chapter is on solving two basic problems in machine learning; classification, that is, how to assign each new input to one of the possible given categories; and data clustering, which is the task of grouping a set of objects in such a way that objects in the same group are more similar to each other than to those in other groups.

Chapter 4, Introducing Neural Networks, provides a quick and detailed introduction of neural networks. These are mathematical models that represent the interconnection between elements, the artificial neurons. They are mathematical constructs that to some extent mimic the properties of living neurons. Neural networks build the foundation on which rests the architecture of deep learning algorithms. Two basic types of neural nets are then implemented: the Single Layer Perceptron and the Multi Layer Perceptron for classification problems.

Chapter 5, Deep Learning, gives an overview of deep learning algorithms. Only in recent years has deep learning collected a large number of results considered unthinkable a few years ago. We’ll show how to implement two fundamental deep learning architectures, convolutional neural networks (CNN) and recurrent neural networks (RNN), for image recognition and speech translation problems  respectively.

Chapter 6, GPU Programming and Serving with TensorFlow, shows the TensorFlow facilities for GPU computing and introduces TensorFlow Serving, a high-performance open source serving system for machine learning models designed for production environments and optimized for TensorFlow.

What you need for this book

All the examples have been implemented using Python version 2.7 on an Ubuntu Linux 64-bit machine, including the TensorFlow library version 0.7.1.

You will also need the following Python modules (preferably the latest version):

PipBazelMatplotlibNumPyPandas

Who this book is for

The reader should have a basic knowledge of programming and math concepts, and at the same time, want to be introduced to the topics of machine and deep learning. After reading this book, you will be able to master TensorFlow’s features to build powerful applications.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

Log in or register to our website using your e-mail address and password.Hover the mouse pointer on the SUPPORT tab at the top.Click on Code Downloads & Errata.Enter the name of the book in the Search box.Select the book for which you're looking to download the code files.Choose from the drop-down menu where you purchased this book from.Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR / 7-Zip for WindowsZipeg / iZip / UnRarX for Mac7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Getting-Started-with-TensorFlow. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/GettingStartedwithTensorFlow_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

Chapter 1. TensorFlow – Basic Concepts

In this chapter, we'll cover the following topics:

Machine learning and deep learning basicsTensorFlow – A general overviewPython basicsInstalling TensorFlowFirst working sessionData Flow GraphTensorFlow programming modelHow to use TensorBoard

Machine learning and deep learning basics

Machine learning is a branch of artificial intelligence, and more specifically of computer science, which deals with the study of systems and algorithms that can learn from data, synthesizing new knowledge from them.

The word learn intuitively suggests that a system based on machine learning, may, on the basis of the observation of previously processed data, improve its knowledge in order to achieve better results in the future, or provide output closer to the desired output for that particular system.

The ability of a program or a system based on machine learning to improve its performance in a particular task, thanks to past experience, is strongly linked to its ability to recognize patterns in the data. This theme, called pattern recognition, is therefore of vital importance and of increasing interest in the context of artificial intelligence; it is the basis of all machine learning techniques.

The training of a machine learning system can be done in different ways:

Supervised learningUnsupervised learning

Supervised learning