Mohasin AhamedChinnapattan
160414733094
CSE
MJCET
160414733094 Mohasin Ahamed
Presentation Outline
• Introduction
• History ofTensorFlow
• Features ofTensorFlow
• Working withTensorFlow
• Example : Iris Classification Problem
• Conclusion
• References
160414733094 Mohasin Ahamed
Introduction
• TensorFlow[1] is an open source software library for numerical computation using
data flow graphs.
• Nodes in the graph represent mathematical operations, while the graph edges
represent the multidimensional data arrays (tensors) communicated between
them.
• It is used by major companies all over the world, including Airbnb, EBay, Dropbox,
Snapchat,Twitter, Uber, SAP, Qualcomm, IBM, Intel, and of course, Google!
160414733094 Mohasin Ahamed
History ofTensorFlow
• DistBelief[3]
• TensorFlow
• Tensor Processing Unit[4]
• TensorFlow Lite[5]
160414733094 Mohasin Ahamed
DistBeleif
• In 2011, Google Brain[2] built DistBelief as a proprietary machine learning system
based on deep learning neural networks.
• Its use grew rapidly across diverse Alphabet companies in both research and
commercial applications.
• Google assigned multiple computer scientists, including Jeff Dean, to simplify and
refactor the codebase of DistBelief into a faster, more robust application-grade
library, which becameTensorFlow.
160414733094 Mohasin Ahamed
TensorFlow
• TensorFlow is Google Brain's second generation system.
• Version 1.0.0 was released on February 11, 2017.
• Fact: In June 2016, Dean stated that 1,500 repositories on GitHub mentioned
TensorFlow, of which only 5 were from Google
160414733094 Mohasin Ahamed
Tensor Processing Unit
• In May 2016 Google announced itsTensor processing unit (TPU), an ASIC built
specifically for machine learning and tailored forTensorFlow.
• TPU is a programmable AI accelerator designed to provide high throughput of
low-precision arithmetic (e.g., 8-bit), and oriented toward using or running models
rather than training them.
• In May 2017 Google announced the second-generation, as well as the availability
of theTPUs in Google Compute Engine.
160414733094 Mohasin Ahamed
TensorFlow Lite
• In May 2017 Google announced a software stack specifically for Android
development,TensorFlow Lite, beginning with Android Oreo.
160414733094 Mohasin Ahamed
Features ofTensorFlow
• Efficiently works with mathematical expressions involving multi-dimensional
arrays
• Good support of deep neural networks and machine learning concepts.
• GPU/CPU computing where the same code can be executed on both architectures
• High scalability of computation across machines and huge data sets
• Supported by a large community of developers
160414733094 Mohasin Ahamed
Comparison of Different M/L Frameworks
Feature TensorFlow Theano[6] Torch[7] Caffe[8] Chainer[9] CNTK[9]
RunOn Single
Machine
Yes Yes Yes Yes Yes Yes
Run on Distributed
Machines
Yes No No No No Yes
Symbolic
differentiation
Yes Yes No No Yes No
Implemented by
C++
Yes No No Yes No No
160414733094 Mohasin Ahamed
160414733094 Mohasin Ahamed
WORKINGWITHTENSORFLOW
• Tensors[10]
• Dataflow Graphs[11]
• Deep Learning
• TensorFlow Programming Stack[12]
• Installing TensorFlow
160414733094 Mohasin Ahamed
Tensors
• Tensors are the basic data structures inTensorFlow, and they represent the connecting
edges in a dataflow graph.
• A tensor simply identifies a multidimensional array or list.The tensor structure can be
identified with three parameters: rank, shape, and type.
160414733094 Mohasin Ahamed
160414733094 Mohasin Ahamed
Dataflow Graphs
• InTensorFlow, computation is described using data flow graphs.
• Each node of the graph represents an instance of a mathematical operation (like
addition, division, or multiplication) and each edge is a multi-dimensional data set
(tensor) on which the operations are performed.
160414733094 Mohasin Ahamed
160414733094 Mohasin Ahamed
Deep Learning
• Deep learning (also known as deep structured learning or hierarchical learning) is
part of a broader family of machine learning methods based on learning data
representations, as opposed to task-specific algorithms. Learning can be
supervised, semi-supervised or unsupervised.
• Deep learning models are loosely related to information processing and
communication patterns in a biological nervous system, such as neural coding that
attempts to define a relationship between various stimuli and associated neuronal
responses in the brain.
160414733094 Mohasin Ahamed
160414733094 Mohasin Ahamed
TensorFlow Programming Stack
160414733094 Mohasin Ahamed
• Estimators, which represent a complete model.The Estimator API provides
methods to train the model, to judge the model's accuracy, and to generate
predictions.
• Datasets, which build a data input pipeline.The Dataset API has methods to load
and manipulate data, and feed it into your model.The DatasetsAPI meshes well
with the Estimators API.
160414733094 Mohasin Ahamed
InstallingTensorFlow
• Step 1: Head over to Python 3.5.x from python.org
• Step 2: Go to the Downloads page and Select the 3.5.2 download.
• Step 3: After that you will be brought to another page, where you will need to
select either the x86-64 or amd64 installer.The one I specifically recommend for
now is theWindows x86-64 executable installer.
• Step 4: Choose Add Python 3.5 to PATH.
• Step 5: Now you should be able to see a message saying Setup was successful.
160414733094 Mohasin Ahamed
• Step 6: To installTensorFlow, start a terminal. Make sure that you run the cmd as
an administrator!
• Step 7: Once you’re done with that, now all you have to do is give just one simple
little command for you to finish installingTensorflow onto yourWindows. Just
enter this command:
pip3 install --upgrade tensorflow
160414733094 Mohasin Ahamed
EXAMPLE: IRIS CLASSIFICATION
PROBLEM [13]
• Imagine you are a botanist seeking an automated way to classify each Iris flower
you find. Machine learning provides many ways to classify flowers.
• For instance, a sophisticated machine learning program could classify flowers
based on photographs.
• Our ambitions are more modest--we're going to classify Iris flowers based solely
on the length and width of their sepals and petals.
160414733094 Mohasin Ahamed
• The Iris genus entails about 300 species, but our program will classify only the
following three:
a) Iris setosa
b) Iris versicolor
c) Iris virginica
Here's the representation:
• 0 represents setosa
• 1 represents versicolor
• 2 represents virginica
160414733094 Mohasin Ahamed
Sepal length Sepal width Petal length Petal width Species
6.4 2.8 5.6 2.2 2
5.0 2.3 3.3 1.0 1
4.9 2.5 4.5 1.7 2
5.7 3.8 1.7 0.3 0
• The last column (species) is called the label; the first four columns are
called features. Features are characteristics of an example, while the
label is the thing we're trying to predict.
160414733094 Mohasin Ahamed
Getting the Sample Program
• Before staring do the following:
1)InstallTensorFlow.
If you installedTensorFlow with virtualenv or Anaconda, activate your
TensorFlow environment.
2)Install or upgrade pandas by issuing the following command:
pip install pandas
160414733094 Mohasin Ahamed
3)Take the following steps to get the sample program:
• Clone theTensorFlow Models repository from GitHub by entering the following command:
git clone https://github.com/tensorflow/models
• Change directory within that branch to the location containing the examples used in this document:
cd models/samples/core/get_started/
160414733094 Mohasin Ahamed
• You runTensorFlow programs as you would run any Python program.Therefore,
issue the following command from a command line to
run premade_estimators.py:
python premade_estimator.py
• Running the program should output a whole bunch of information ending with
three prediction lines like the following:
160414733094 Mohasin Ahamed
160414733094 Mohasin Ahamed
CONCLUSION
• In the end we can say thatTensorFlow is the second machine learning framework
that Google created and used to design, build, and train deep learning models.
• You can use theTensorFlow library do to numerical computations, which in itself
doesn’t seem all too special, but these computations are done with data flow
graphs.
• And it is used by major companies all over the world, including Airbnb, EBay,
Dropbox, Snapchat,Twitter, Uber, SAP, Qualcomm, IBM, Intel, and of course,
Google!
160414733094 Mohasin Ahamed
References
• [1]TensorFlow https://www.tensorflow.org/
• [2] Google Brain https://en.wikipedia.org/wiki/Google_Brain/
• [3] DistBeleif https://research.google.com/pubs/pub40565.html
• [4]Tensor Processing Unit https://en.wikipedia.org/wiki/Tensor_processing_unit
• [5]TensorFlow Lite https://www.tensorflow.org/mobile/tflite/
• [6]Theano http://deeplearning.net/software/theano/;
https://en.wikipedia.org/wiki/Theano/
• [7]Torch http://torch.ch/; https://en.wikipedia.org/wiki/Torch_(machine_learning)
160414733094 Mohasin Ahamed
• [8] Caffe http://caffe.berkeleyvision.org/; https://github.com/BVLC/caffe
• [9] Chainer https://chainer.org/; https://github.com/chainer
• [10] CNTK https://github.com/Microsoft/CNTK; https://www.microsoft.com/en-us/cognitive-
toolkit/
• [11]GitHub https://github.com/; https://en.wikipedia.org/wiki/GitHub
• [12]Tensors https://en.wikipedia.org/wiki/Tensor;
https://www.tensorflow.org/programmers_guide/tensors
• [13] Dataflow Graphs http://bears.ece.ucsb.edu/research-info/DP/dfg.html;
https://www.tensorflow.org/programmers_guide/graphs
• [14]TensorFlow Programming Stack
https://www.tensorflow.org/get_started/premade_estimators
• [15] Python https://www.python.org/;
https://en.wikipedia.org/wiki/Python_(programming_language)
• [16] Iris Classification Problem
https://www.neuraldesigner.com/learning/examples/iris_flowers_classification;
• [17] Iris Flower Dataset https://en.wikipedia.org/wiki/Iris_flower_data_set
160414733094 Mohasin Ahamed

Introduction Tensorflow

  • 1.
  • 2.
    Presentation Outline • Introduction •History ofTensorFlow • Features ofTensorFlow • Working withTensorFlow • Example : Iris Classification Problem • Conclusion • References 160414733094 Mohasin Ahamed
  • 3.
    Introduction • TensorFlow[1] isan open source software library for numerical computation using data flow graphs. • Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them. • It is used by major companies all over the world, including Airbnb, EBay, Dropbox, Snapchat,Twitter, Uber, SAP, Qualcomm, IBM, Intel, and of course, Google! 160414733094 Mohasin Ahamed
  • 4.
    History ofTensorFlow • DistBelief[3] •TensorFlow • Tensor Processing Unit[4] • TensorFlow Lite[5] 160414733094 Mohasin Ahamed
  • 5.
    DistBeleif • In 2011,Google Brain[2] built DistBelief as a proprietary machine learning system based on deep learning neural networks. • Its use grew rapidly across diverse Alphabet companies in both research and commercial applications. • Google assigned multiple computer scientists, including Jeff Dean, to simplify and refactor the codebase of DistBelief into a faster, more robust application-grade library, which becameTensorFlow. 160414733094 Mohasin Ahamed
  • 6.
    TensorFlow • TensorFlow isGoogle Brain's second generation system. • Version 1.0.0 was released on February 11, 2017. • Fact: In June 2016, Dean stated that 1,500 repositories on GitHub mentioned TensorFlow, of which only 5 were from Google 160414733094 Mohasin Ahamed
  • 7.
    Tensor Processing Unit •In May 2016 Google announced itsTensor processing unit (TPU), an ASIC built specifically for machine learning and tailored forTensorFlow. • TPU is a programmable AI accelerator designed to provide high throughput of low-precision arithmetic (e.g., 8-bit), and oriented toward using or running models rather than training them. • In May 2017 Google announced the second-generation, as well as the availability of theTPUs in Google Compute Engine. 160414733094 Mohasin Ahamed
  • 8.
    TensorFlow Lite • InMay 2017 Google announced a software stack specifically for Android development,TensorFlow Lite, beginning with Android Oreo. 160414733094 Mohasin Ahamed
  • 9.
    Features ofTensorFlow • Efficientlyworks with mathematical expressions involving multi-dimensional arrays • Good support of deep neural networks and machine learning concepts. • GPU/CPU computing where the same code can be executed on both architectures • High scalability of computation across machines and huge data sets • Supported by a large community of developers 160414733094 Mohasin Ahamed
  • 10.
    Comparison of DifferentM/L Frameworks Feature TensorFlow Theano[6] Torch[7] Caffe[8] Chainer[9] CNTK[9] RunOn Single Machine Yes Yes Yes Yes Yes Yes Run on Distributed Machines Yes No No No No Yes Symbolic differentiation Yes Yes No No Yes No Implemented by C++ Yes No No Yes No No 160414733094 Mohasin Ahamed
  • 11.
  • 12.
    WORKINGWITHTENSORFLOW • Tensors[10] • DataflowGraphs[11] • Deep Learning • TensorFlow Programming Stack[12] • Installing TensorFlow 160414733094 Mohasin Ahamed
  • 13.
    Tensors • Tensors arethe basic data structures inTensorFlow, and they represent the connecting edges in a dataflow graph. • A tensor simply identifies a multidimensional array or list.The tensor structure can be identified with three parameters: rank, shape, and type. 160414733094 Mohasin Ahamed
  • 14.
  • 15.
    Dataflow Graphs • InTensorFlow,computation is described using data flow graphs. • Each node of the graph represents an instance of a mathematical operation (like addition, division, or multiplication) and each edge is a multi-dimensional data set (tensor) on which the operations are performed. 160414733094 Mohasin Ahamed
  • 16.
  • 17.
    Deep Learning • Deeplearning (also known as deep structured learning or hierarchical learning) is part of a broader family of machine learning methods based on learning data representations, as opposed to task-specific algorithms. Learning can be supervised, semi-supervised or unsupervised. • Deep learning models are loosely related to information processing and communication patterns in a biological nervous system, such as neural coding that attempts to define a relationship between various stimuli and associated neuronal responses in the brain. 160414733094 Mohasin Ahamed
  • 18.
  • 19.
  • 20.
    • Estimators, whichrepresent a complete model.The Estimator API provides methods to train the model, to judge the model's accuracy, and to generate predictions. • Datasets, which build a data input pipeline.The Dataset API has methods to load and manipulate data, and feed it into your model.The DatasetsAPI meshes well with the Estimators API. 160414733094 Mohasin Ahamed
  • 21.
    InstallingTensorFlow • Step 1:Head over to Python 3.5.x from python.org • Step 2: Go to the Downloads page and Select the 3.5.2 download. • Step 3: After that you will be brought to another page, where you will need to select either the x86-64 or amd64 installer.The one I specifically recommend for now is theWindows x86-64 executable installer. • Step 4: Choose Add Python 3.5 to PATH. • Step 5: Now you should be able to see a message saying Setup was successful. 160414733094 Mohasin Ahamed
  • 22.
    • Step 6:To installTensorFlow, start a terminal. Make sure that you run the cmd as an administrator! • Step 7: Once you’re done with that, now all you have to do is give just one simple little command for you to finish installingTensorflow onto yourWindows. Just enter this command: pip3 install --upgrade tensorflow 160414733094 Mohasin Ahamed
  • 23.
    EXAMPLE: IRIS CLASSIFICATION PROBLEM[13] • Imagine you are a botanist seeking an automated way to classify each Iris flower you find. Machine learning provides many ways to classify flowers. • For instance, a sophisticated machine learning program could classify flowers based on photographs. • Our ambitions are more modest--we're going to classify Iris flowers based solely on the length and width of their sepals and petals. 160414733094 Mohasin Ahamed
  • 24.
    • The Irisgenus entails about 300 species, but our program will classify only the following three: a) Iris setosa b) Iris versicolor c) Iris virginica Here's the representation: • 0 represents setosa • 1 represents versicolor • 2 represents virginica 160414733094 Mohasin Ahamed
  • 25.
    Sepal length Sepalwidth Petal length Petal width Species 6.4 2.8 5.6 2.2 2 5.0 2.3 3.3 1.0 1 4.9 2.5 4.5 1.7 2 5.7 3.8 1.7 0.3 0 • The last column (species) is called the label; the first four columns are called features. Features are characteristics of an example, while the label is the thing we're trying to predict. 160414733094 Mohasin Ahamed
  • 26.
    Getting the SampleProgram • Before staring do the following: 1)InstallTensorFlow. If you installedTensorFlow with virtualenv or Anaconda, activate your TensorFlow environment. 2)Install or upgrade pandas by issuing the following command: pip install pandas 160414733094 Mohasin Ahamed
  • 27.
    3)Take the followingsteps to get the sample program: • Clone theTensorFlow Models repository from GitHub by entering the following command: git clone https://github.com/tensorflow/models • Change directory within that branch to the location containing the examples used in this document: cd models/samples/core/get_started/ 160414733094 Mohasin Ahamed
  • 28.
    • You runTensorFlowprograms as you would run any Python program.Therefore, issue the following command from a command line to run premade_estimators.py: python premade_estimator.py • Running the program should output a whole bunch of information ending with three prediction lines like the following: 160414733094 Mohasin Ahamed
  • 29.
  • 30.
    CONCLUSION • In theend we can say thatTensorFlow is the second machine learning framework that Google created and used to design, build, and train deep learning models. • You can use theTensorFlow library do to numerical computations, which in itself doesn’t seem all too special, but these computations are done with data flow graphs. • And it is used by major companies all over the world, including Airbnb, EBay, Dropbox, Snapchat,Twitter, Uber, SAP, Qualcomm, IBM, Intel, and of course, Google! 160414733094 Mohasin Ahamed
  • 31.
    References • [1]TensorFlow https://www.tensorflow.org/ •[2] Google Brain https://en.wikipedia.org/wiki/Google_Brain/ • [3] DistBeleif https://research.google.com/pubs/pub40565.html • [4]Tensor Processing Unit https://en.wikipedia.org/wiki/Tensor_processing_unit • [5]TensorFlow Lite https://www.tensorflow.org/mobile/tflite/ • [6]Theano http://deeplearning.net/software/theano/; https://en.wikipedia.org/wiki/Theano/ • [7]Torch http://torch.ch/; https://en.wikipedia.org/wiki/Torch_(machine_learning) 160414733094 Mohasin Ahamed
  • 32.
    • [8] Caffehttp://caffe.berkeleyvision.org/; https://github.com/BVLC/caffe • [9] Chainer https://chainer.org/; https://github.com/chainer • [10] CNTK https://github.com/Microsoft/CNTK; https://www.microsoft.com/en-us/cognitive- toolkit/ • [11]GitHub https://github.com/; https://en.wikipedia.org/wiki/GitHub • [12]Tensors https://en.wikipedia.org/wiki/Tensor; https://www.tensorflow.org/programmers_guide/tensors • [13] Dataflow Graphs http://bears.ece.ucsb.edu/research-info/DP/dfg.html; https://www.tensorflow.org/programmers_guide/graphs • [14]TensorFlow Programming Stack https://www.tensorflow.org/get_started/premade_estimators • [15] Python https://www.python.org/; https://en.wikipedia.org/wiki/Python_(programming_language) • [16] Iris Classification Problem https://www.neuraldesigner.com/learning/examples/iris_flowers_classification; • [17] Iris Flower Dataset https://en.wikipedia.org/wiki/Iris_flower_data_set 160414733094 Mohasin Ahamed