TensorFlow 2.0 Quick Start Guide
eBook - ePub

TensorFlow 2.0 Quick Start Guide

Get up to speed with the newly introduced features of TensorFlow 2.0

Tony Holdroyd

  1. 196 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

TensorFlow 2.0 Quick Start Guide

Get up to speed with the newly introduced features of TensorFlow 2.0

Tony Holdroyd

Book details
Book preview
Table of contents
Citations

About This Book

Perform supervised and unsupervised machine learning and learn advanced techniques such as training neural networks.

Key Features

  • Train your own models for effective prediction, using high-level Keras API
  • Perform supervised and unsupervised machine learning and learn advanced techniques such as training neural networks
  • Get acquainted with some new practices introduced in TensorFlow 2.0 Alpha

Book Description

TensorFlow is one of the most popular machine learning frameworks in Python. With this book, you will improve your knowledge of some of the latest TensorFlow features and will be able to perform supervised and unsupervised machine learning and also train neural networks.

After giving you an overview of what's new in TensorFlow 2.0 Alpha, the book moves on to setting up your machine learning environment using the TensorFlow library. You will perform popular supervised machine learning tasks using techniques such as linear regression, logistic regression, and clustering.

You will get familiar with unsupervised learning for autoencoder applications. The book will also show you how to train effective neural networks using straightforward examples in a variety of different domains.

By the end of the book, you will have been exposed to a large variety of machine learning and neural network TensorFlow techniques.

What you will learn

  • Use tf.Keras for fast prototyping, building, and training deep learning neural network models
  • Easily convert your TensorFlow 1.12 applications to TensorFlow 2.0-compatible files
  • Use TensorFlow to tackle traditional supervised and unsupervised machine learning applications
  • Understand image recognition techniques using TensorFlow
  • Perform neural style transfer for image hybridization using a neural network
  • Code a recurrent neural network in TensorFlow to perform text-style generation

Who this book is for

Data scientists, machine learning developers, and deep learning enthusiasts looking to quickly get started with TensorFlow 2 will find this book useful. Some Python programming experience with version 3.6 or later, along with a familiarity with Jupyter notebooks will be an added advantage. Exposure to machine learning and neural network techniques would also be helpful.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is TensorFlow 2.0 Quick Start Guide an online PDF/ePUB?
Yes, you can access TensorFlow 2.0 Quick Start Guide by Tony Holdroyd in PDF and/or ePUB format, as well as other popular books in Computer Science & Neural Networks. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781789536966
Edition
1

Section 1: Introduction to TensorFlow 2.00 Alpha

In this section, we will introduce TensorFlow 2.00 alpha. We will begin with an overview of the major features of this machine learning ecosystem and see some examples of its use. We will then introduce TensorFlow's high-level Keras API. We will end the section with an investigation of artificial neural network technologies and techniques.
This section contains the following chapters:
  • Chapter 1, Introducing TensorFlow 2
  • Chapter 2, Keras, a High-Level API for TensorFlow 2
  • Chapter 3, ANN Technologies Using TensorFlow 2

Introducing TensorFlow 2

TensorFlow began its life in 2011 as DisBelief, an internal, closed source project at Google. DisBelief was a machine learning system that employed deep learning neural networks. This system morphed into TensorFlow, which was released to the developer community under an Apache 2.0 open source license, on November 9, 2015. Version 1.0.0 made its appearance on February 11, 2017. There have been a number of point releases since then that have incorporated a wealth of new features.
At the time of writing this book, the most recent version is TensorFlow 2.0.0 alpha release, which was announced at the TensorFlow Dev Summit on March 6, 2019.
TensorFlow takes its name from, well, tensors. A tensor is a generalization of vectors and matrices to possibly higher dimensions. The rank of a tensor is the number of indices it takes to uniquely specify each element of that tensor. A scalar (a simple number) is a tensor of rank 0, a vector is a tensor of rank 1, a matrix is a tensor of rank 2, and a 3-dimensional array is a tensor of rank 3. A tensor has a datatype and a shape (all of the data items in a tensor must have the same type). An example of a 4-dimensional tensor (that is, rank 4) is an image where the dimensions are an example within—batch, height, width, and color channel (for example):
image1 = tf.zeros([7, 28, 28, 3]) #  example-within-batch by height by width by color
Although TensorFlow can be leveraged for many areas of numerical computing in general, and machine learning in particular, its main area of research and development has been in the applications of Deep Neural Networks (DNN), where it has been used in diverse areas such as voice and sound recognition, for example, in the now widespread voice-activated assistants; text-based applications such as language translators; image recognition such as exo-planet hunting, cancer detection, and diagnosis; and time series applications such as recommendation systems.
In this chapter, we will discuss the following:
  • Looking at the modern TensorFlow ecosystem
  • Installing TensorFlow
  • Housekeeping and eager operations
  • Providing useful TensorFlow operations

Looking at the modern TensorFlow ecosystem

Let's discuss eager execution. The first incarnation of TensorFlow involved constructing a computational graph made up of operations and tensors, which had to be subsequently evaluated in what Google termed as session (this is known as declarative programming). This is still a common way to write TensorFlow programs. However, eager execution, available from release 1.5 onward in research form and baked into TensorFlow proper from release 1.7, involves the immediate evaluation of operations, with the consequence that tensors can be treated like NumPy arrays (this is known as imperative programming).
Google says that eager execution is the preferred method for research and development but that computational graphs are to be preferred for serving TensorFlow production applications.
tf.data is an API that allows you to build complicated data input pipelines from simpler, reusable parts. The highest level abstraction is Dataset, which comprises both elements of nested structures of tensors and a plan of transformations that are to act on those elements. There are classes for the following:
  • There's Dataset consisting of fixed length record sets from at least one binary file (FixedLengthRecordDataset)
  • There's Dataset consisting of records from at least one TFRecord file (TFRecordDataset)
  • There's Dataset consisting of records that are lines from at least one text file (TFRecordDataset)
  • There is also a class that represents the state of iterating through Dataset (tf.data.Iterator)
Let's move on to the estimator, which is a high-level API that allows you to build greatly simplified machine learning programs. Estimators take care of training, evaluation, prediction, and exports for serving.
TensorFlow.js is a collection of APIs that allow you to build and train models using either the low-level JavaScript linear algebra library or the high-level layers API. Hence, models can be trained and run in a browser.
TensorFlow Lite is a lightweight version of TensorFlow for mobile and embedded devices. It consists of a runtime interpreter and a set of utilities. The idea is that you train a model on a higher-powered machine and then convert your model into the .tflite format using the utilities. You then load the model into your device of choice. At the time of writing, TensorFlow Lite is supported on Android and iOS with a C++ API and has a Java wrapper for Android. If an Android device supports the Android Neural Networks (ANN) API for hardware acceleration, then the interpreter will use this, or else it will default to the CPU for execution.
TensorFlow Hub is a library designed to foster the publication, discovery, and use of reusable modules of machine learning models. In this context, a module is a self-contained piece of a TensorFlow graph together with its weights and other assets. The module can be reused in different tasks in a method known as transfer learning. The idea is that you t...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Contributors
  6. Preface
  7. Section 1: Introduction to TensorFlow 2.00 Alpha
  8. Introducing TensorFlow 2
  9. Keras, a High-Level API for TensorFlow 2
  10. ANN Technologies Using TensorFlow 2
  11. Section 2: Supervised and Unsupervised Learning in TensorFlow 2.00 Alpha
  12. Supervised Machine Learning Using TensorFlow 2
  13. Unsupervised Learning Using TensorFlow 2
  14. Section 3: Neural Network Applications of TensorFlow 2.00 Alpha
  15. Recognizing Images with TensorFlow 2
  16. Neural Style Transfer Using TensorFlow 2
  17. Recurrent Neural Networks Using TensorFlow 2
  18. TensorFlow Estimators and TensorFlow Hub
  19. Converting from tf1.12 to tf2
  20. Other Books You May Enjoy
Citation styles for TensorFlow 2.0 Quick Start Guide

APA 6 Citation

Holdroyd, T. (2019). TensorFlow 2.0 Quick Start Guide (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/955583/tensorflow-20-quick-start-guide-get-up-to-speed-with-the-newly-introduced-features-of-tensorflow-20-pdf (Original work published 2019)

Chicago Citation

Holdroyd, Tony. (2019) 2019. TensorFlow 2.0 Quick Start Guide. 1st ed. Packt Publishing. https://www.perlego.com/book/955583/tensorflow-20-quick-start-guide-get-up-to-speed-with-the-newly-introduced-features-of-tensorflow-20-pdf.

Harvard Citation

Holdroyd, T. (2019) TensorFlow 2.0 Quick Start Guide. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/955583/tensorflow-20-quick-start-guide-get-up-to-speed-with-the-newly-introduced-features-of-tensorflow-20-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Holdroyd, Tony. TensorFlow 2.0 Quick Start Guide. 1st ed. Packt Publishing, 2019. Web. 14 Oct. 2022.