TF Strata
TF Strata
TF Strata
Strata
March 14, 2017
These slides:
http://bit.ly/tf-strata
Amy Yufeng
[email protected] [email protected]
@amygdala @YufengG
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Welcome and Logistics
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 4
Slides: http://bit.ly/tf-strata
GitHub:
https://github.com/amygdala/tensorflow-workshop
https://github.com/random-forests/WTM
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Brief intro to some NN concepts
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 7
What is Machine Learning?
Field of study that gives computers the ability to learn without being
explicitly programmed".
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 8
What is Machine Learning?
You can think of ML as programming with data instead of instructions.
The system learns from the data so it can react correctly to new data.".
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 9
What is Machine Learning?
But: http://research.google.com/pubs/pub43146.html
("Machine Learning: The High Interest Credit Card of Technical Debt")
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 10
Deep Learning
Current state of the art in many tasks:
Many more.
Why now?
Performance improvements: GPUs & Cloud computing
Algorithmic improvements
Larger datasets
Excellent tools
Open Source Models
github.com/tensorflow/models
Show and Tell
https://research.googleblog.com/2016/09/show-and-tell-image-captioning-open.html
Parsey McParseface
https://research.googleblog.com/2016/05/announcing-syntaxnet-worlds-most.html
Parseys Cousins, in 40 languages
https://research.googleblog.com/2016/08/meet-parseys-cousins-syntax-for-40.html
Translation
https://research.googleblog.com/2016/09/a-neural-network-for-machine.html
Summarization
Original text
Alice and Bob took the train to visit the zoo. They saw a baby giraffe, a
lion, and a flock of colorful tropical birds.
Abstractive summary
Alice and Bob visited the zoo and saw animals and birds.
https://research.googleblog.com/2016/08/text-summarization-with-tensorflow.html
Inception: Image classification
An Alaskan Malamute (left) and a Siberian Husky (right). Images from Wikipedia.
https://research.googleblog.com/2016/08/improving-inception-and-image.html
Transfer Learning
Image: neuralnetworksanddeeplearning.com
Bootstrapping with the Inception model
22
Detection of Diabetic Eye Disease
https://research.googleblog.com/2016/11/deep-learning-for-detection-of-diabetic.html
Skin Cancer Image Classification
Benign
Malignant
http://www.nature.com/nature/journal/v542/n7639/full/nature21056.html
Hug?
Dont Hug?
https://goo.gl/zB8TrG
25
TensorFlow for Poets
Codelab goo.gl/xGsB9d
Video goo.gl/KewA03
Shared Research in TensorFlow
Inception https://research.googleblog.com/2016/08/improving-inception-and-image.html
Translation https://research.googleblog.com/2016/09/a-neural-network-for-machine.html
Summarization https://research.googleblog.com/2016/08/text-summarization-with-tensorflow.html
Pathology https://research.googleblog.com/2017/03/assisting-pathologists-in-detecting.html
goo.gl/WPJtVe
Image source - Wikipedia
Fast Style Transfer
From https://github.com/lengstrom/fast-style-transfer/
From https://github.com/lengstrom/fast-style-transfer/
From: A Matlab Plugin to Visualize Neurons from Deep Models, Donglai Wei et. al.
https://github.com/lengstrom/fast-style-transfer/
https://research.googleblog.com/2016/10/supercharging-style-transfer.html
Multistyle Transfer with
Project Magenta
https://en.wikipedia.org/
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 28 29
Drive folder
goo.gl/1UDjBE
30 31
Blending styles
magenta.tensorflow.org
Check out this great talk
goo.gl/ZFzpzu
Learn more
Paper
goo.gl/6fS16m
Whats TensorFlow?
(and why is it so great for ML?)
A graph of operations.
A graph of
A multidimensional array.
operations.
10000 Images
Each Image has 256 Rows
Each Row has 256 Pixels
Each Pixel has 3 channels (RGB)
MatMul Xent
examples
labels
s o rs
Computation is a dataflow graph ten
with
MatMul Xent
examples
labels
t a t e
Computation is a dataflow graph
w ith s
biases
learning rate
Build a graph; then run it.
From: http://googleresearch.blogspot.com/2016_03_01_archive.html
https://www.tensorflow.org/versions/r0.12/how_tos/embedding_viz/index.html
playground.tensorflow.org
TensorFlow API Documentation:
https://www.tensorflow.org/api_docs/
import numpy as np
import tensorflow as tf
# a constant
m1 = np.array([[1.,2.], [3.,4.], [5.,6.], [7., 8.]], dtype=np.float32)
- Constants
- Placeholders: must be fed with data on execution
- Variables: a modifiable tensor that lives in TensorFlow's
graph of interacting operations.
- Session: encapsulates the environment in which Operation
objects are executed, and Tensor objects are evaluated.
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 71
Lets add more nodes to this graph..
Follow along at:
https://github.com/amygdala/tensorflow-workshop/tree/master/workshop_sections/starter_tf_graph
Add m3 to itself
Store the result in m4
Return the results for both m3 and m4
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 72
MNIST: The Hello World Of ML
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 74
What we see What the computer sees
Training data Testing data
training_data = mnist.train.images
training_labels = mnist.train.labels
testing_data = mnist.test.images
testing_labels = mnist.test.labels
A simple version of MNIST
f(x)= mx + b * L
y = 0 if f(x) < 0
y = f(x) otherwise
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 80
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 81
Minimize loss: optimizers
error
tf.train.GradientDescentOptimizer
function minimum
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 83
Because TensorFlow knows the entire graph of your computations, it can
automatically use the backpropagation algorithm to efficiently determine
how your variables affect the cost (loss function) you ask it to minimize.
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 84
one-hot decoding
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 85
Common TF NN pattern:
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 86
Lab: A simple version of MNIST
Workshop section:
mnist_series/
01_README_mnist_simple.md
Hidden layers
{
...
0 1 2 9
One fully connected NN layer typically looks like...
Implementation as Matrix Multiplication
ReLu
(Rectified
Linear unit)
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 92
Models in a box
Canned Estimators
Workshop section:
mnist_series/mnist_tflearn.md
Predefined estimators
,
Limited configuration options: feature columns, metrics.
Workshop section:
wide_n_deep
fnlwgt Continuous The number of people the census takers believe that
observation represents (sample weight). This variable will
not be used.
education Categorical The highest level of education achieved for that individual.
http://bit.ly/tf-workshop-slides bit.ly/tensorflow-workshop
116
File Queues
http://bit.ly/tf-strata bit.ly/tensorflow-workshop
Google Cloud Platform 127
To the code!