TensorFlow is a machine learning library for building and training neural networks. It can handle everything from low-level graph construction using tensors and operations, to high-level neural network models. Key steps in using TensorFlow include defining the network architecture, preprocessing data, training the model to minimize a loss function, and deploying the trained model. Hello world examples demonstrate building simple graphs to multiply and add placeholders and constants.
2. 1
TensorFlow is still your best bet!
Deep Learning Libraries Landscape
Source: Getting started with Deep Learning – Review of available tools (https://svds.com/getting-started-deep-learning/)
3. 2
What and Why?
• Machine Learning Library
• Built for Neural Networks
• Nascent support for other models
• Developed by Google, released
as open source in Nov. 2015
• Python & C++ APIs
• Multi-platform:
• Mac, Linux, Windows, iOS, Android
• Support for CPU + GPU and
Distributed Computation
• Active Community
• Built for Research and
Production
TensorFlow
7. 6
Key Steps
Step 1: Data pre-processing
- Missing value imputation
- Mean scaling and
normalization
- Preparation for mini-batches
Step 2: Define the network
architecture
- Type of NN
- Layers, sizes
- Activation and output
functions
Step 3: Train the network
- Loss function
- Optimization function
- Train/CV/Test sets
Step 4: Model serving
- Store the trained network
- Run!
TensorFlow Application
14. • Session.run([y]) will return the Tensor output of node “y” after
evaluating all other nodes in this graph
13
Sessions are used to evaluate node outputs
Running the Graph
Add
“y”
Placehol
der
“x”
Constan
t
“w”
Constan
t
“b”
Multiply
“prod”
19. • tf.constant
• Evaluates to a constant tensor
• Tensor must be specified during graph construction
• tf.Variable
• Evaluates to a Tensor of fixed type and shape with variable values
• Initial values must be specified before evaluation
• “Trainable” by default
• tf.placeholder
• Creates a node to allow a Tensor to be passed at runtime
• e.g. Used for feeding new data into a graph
17
Feeding data
Inputs and model parameters
20. • Standard math functions you might expect:
• tf.add/tf.subtract (overloaded with +/-)
• tf.matmul
• Useful “reduce” functions:
• tf.reduce_mean
• tf.reduce_sum
• tf.reduce_max
• tf.reduce_min
https://www.tensorflow.org/api_guides/python/math_ops
18
High school math, but now with Tensors!
Standard Math
21. • Activation Functions:
• tf.sigmoid
• tf.tanh
• tf.nn.relu
• Classification Functions:
• tf.nn.softmax
• Alternative NN Architectures:
• tf.nn.conv* (many convolution Ops)
• tf.nn.pool
More info at: https://www.tensorflow.org/versions/r1.0/api_docs/python/nn/
19
Functions to build up neural networks
Neural Network Functions
22. • Loss Functions:
• tf.nn.l2_loss
• tf.nn.softmax_cross_entropy_with_logits
• Optimizers:
• tf.train.GradientDescentOptimizer
• tf.train.AdamOptimizer
• tf.train.AdagradOptimizer
• Note: Automatic gradient calculation based on the Graph!
20
How well is the model doing? And how can it get better?
Loss Functions and Optimizers
Editor's Notes
When adding an image to the background adjust transparency to 25%
Deep learning 4J
Keras is a high level wrapper on top of TF or Theano
Torch is Lua based
When adding an image to the background adjust transparency to 25%
When adding an image to the background adjust transparency to 25%
When adding an image to the background adjust transparency to 25%
When adding an image to the background adjust transparency to 25%
When adding an image to the background adjust transparency to 25%