Chapter 2. A First Look at TensorFlow

TensorFlow is a mathematical software and an open source framework for deep learning developed by the Google Brain Team in 2011. Nevertheless, it can be used to help us analyze data in order to predict an effective business outcome.

Although the initial target of TensorFlow was to conduct research in ML and in Deep Neural Networks(DNNs), the system is general enough to be applicable to a wide variety of classical machine learning algorithm such as Support Vector Machine (SVM), logistic regression, decision trees, and random forest.

Keeping in mind your needs and based on all the latest exciting features of the most stable version 1.6 (v1.7 was the pre-release during the production stage of this book), in this chapter, we will describe the main capabilities and core concepts of TensorFlow that will be used in all the subsequent chapters.

The following topics will be covered in this chapter:

  • A general overview of TensorFlow
  • What's new from TensorFlow v1.6 forwards?
  • TensorFlow computational graph
  • TensorFlow code structure
  • TensorFlow data model
  • Visualizing computations through TensorBoard
  • Linear regression and beyond

A general overview of TensorFlow

TensorFlow is an open source framework from Google for scientific and numerical computation using data flow graphs that stand for TensorFlow's execution model. The data flow graphs used in TensorFlow help ML experts to perform more advanced and intensive training on their data to develop DL and predictive analytics models.

As the name implies, TensorFlow includes operations that are performed by neural networks on multidimensional data arrays, that is, flow of tensors. Nodes in a flow graph correspond to mathematical operations, that is, addition, multiplication, matrix factorization, and so on; whereas, edges correspond to tensors that ensure communication between edges and nodes – that is, data flow and control flow. This way, TensorFlow provides some widely used and robustly implemented linear models and DL algorithms.

You can perform numerical computations on a CPU. However, with TensorFlow, it is also possible to distribute the training among multiple devices on the same system, especially if you have more than one GPU on your system that can share the computational load.

Deploying a predictive or general-purpose model using TensorFlow is straightforward. Once you have constructed your neural network model after the required feature engineering, you can simply perform the training interactively and use the TensorBoard to visualize your TensorFlow graph, plot quantitative metrics about the execution of your graph, and show additional data like images that pass through it.

If TensorFlow can access GPU devices, it will automatically distribute computations to multiple devices via a greedy process. Therefore, no special configuration is needed to utilize the cores of the CPU. Nevertheless, TensorFlow also allows the program to specify which operations will be on which device via name scope placement. Finally, after evaluating the model, you deploy it by feeding some test data to it. The main features offered by the latest release of TensorFlow are as follows:

  • Faster computing: The latest release of TensorFlow is incredibly fast. For example, the Inception-v3 model runs 7.3 times faster on 8 GPUs, and distributed Inception-v3 runs 58 times faster on 64 GPUs.
  • Flexibility: TensorFlow is not just a DL library. It comes with almost everything you need for powerful mathematical operations, thanks to its functions for solving the most difficult problems.
  • Portability: TensorFlow runs on Windows (only CPU support, though), Linux, and Mac machines, and on mobile computing platforms (that is, Android).
  • Easy debugging: TensorFlow provides the TensorBoard tool, which is useful for analyzing the models you develop.
  • Unified API: TensorFlow offers you a very flexible architecture that enables you to deploy computation to one or more CPUs or GPUs on a desktop, server, or mobile device with a single API.
  • Transparent use of GPU computing: TensorFlow now automates the management and optimization of the memory and the data used. You can now use your machine for large-scale and data-intensive GPU computing with NVIDIA's cuDNN and CUDA toolkits.
  • Easy use: TensorFlow is for everyone. It is not only suitable for students, researchers, DL practitioners, but also for professionals who work in the industries.
  • Production-ready at scale: Recently, TensorFlow has evolved into a neural network for machine translation at production scale. TensorFlow 1.6 promises Python API stability, making it easier to choose new features without worrying too much about breaking your existing code.
  • Extensibility: TensorFlow is a relatively new technology, and it's still in active development. The source codes are available on GitHub (https://github.com/tensorflow/tensorflow).
  • Support: There is a large community of developers and users working together to make TensorFlow a better product, both by providing feedback and by actively contributing to the source code.
  • Wide adoption: Numerous tech giants use TensorFlow to increase their business intelligence, such as ARM, Google, Intel, eBay, Qualcomm, SAM, Dropbox, DeepMind, Airbnb, and Twitter.

Now, before we start coding with TensorFlow, let's see what the new features in TensorFlow's latest release.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.12.85