SlideShare a Scribd company logo
1 of 38
Download to read offline
Language Translation with
Deep Learning
Using TensorFlow on FloydHub
About me
Machine Learning and Big Data Architect
MS Computer Science, Machine Learning, Georgia Tech
Deep Learning Nanodegree, Udacity
Artificial Intelligence Nanodegree, Udacity
Connect
Twitter : @techmazed
LinkedIn : https://www.linkedin.com/in/knownasar
● This is a group for anyone interested in AI, Machine Learning, Deep Learning,
NLP, Deep RL, Image Recognition, Speech Recognition etc.
● All backgrounds are welcome!
● This group is created in order to bring AI enthusiasts together, build the
leading AI community and move forward the research and technology
advancement in the AI related subfields.
Join the conversations at
Meetup Group: https://www.meetup.com/Nashville-Artificial-Intelligence-Society/
LinkedIn Group: https://www.linkedin.com/groups/12043828
Twitter: @AINashville (https://twitter.com/AInashville)
p.s. We are currently looking for venue Sponsors!
About Nashville AI Society Meetup
● The Language Translation challenge
● Introducing Deep Learning
● Introducing RNN
● Introducing NLP concepts
● Brief introduction to TensorFlow & FloydHub
● The solution approach
● Demo time and code walkthrough
● What next!
● Question time
What we’ll cover
The Language Translation challenge
We will be training a sequence to sequence model on a dataset of English and
French sentences that can translate new sentences from English to French
We use a small portion of the English & French corpus
Language translation challenge
English:
new jersey is sometimes quiet during autumn , and it is snowy in april .
French:
new jersey est parfois calme pendant l' automne , et il est neigeux en avril .
Introducing Deep Learning
Field of Deep Learning Buckets of DL
Deep Learning vs Traditional Algorithms
Data vs Performance
Source: https://www.youtube.com/watch?v=F1ka6a13S9I
What is Deep Learning
Neural networks with large number
of parameters and layers.
The layers belong to one of four
fundamental network architectures:
● Unsupervised Pre-Trained
Networks
● Convolutional Neural Networks
● Recurrent Neural Networks
● Recursive Neural Networks
A neural Network is an algorithm that learns
to identify patterns in data
Backpropagation is a technique to train a
Neural Net by updating weights via gradient
descent
Deep Learning :
many layer neural net + massive data (big
data) + massive compute (GPU)
Multi-Layer Neural Network topology
The behavior of neural networks is
shaped by its network architecture.
A network’s architecture can be
defined, in part, by:
● number of neurons
● number of layers
● types of connections between
layers
Backpropagation Learning
Backpropagation is an important part of reducing error in a neural network
model.
function neural-network-learning( training-records ) returns network
network <- initialize weights (randomly)
start loop
for each example in training-records do
network-output = neural-network-output( network, example )
actual-output = observed outcome associated with example
update weights in network based on { example, network-output, actual-output }
end for
end loop when all examples correctly predicted or hit stopping conditions
return network
General Neural Network Training Pseudocode
Introducing Recurrent Neural Network
What is RNN?
They are networks with loops in them, allowing information to persist. Recurrent Neural Networks have
loops.
In the above diagram, a chunk of neural network, A, looks at some input xt and outputs a value ht.
A loop allows information to be passed from one step of the network to the next.
A recurrent neural network can be thought of as multiple copies of the same network, each passing a
message to a successor. Consider what happens if we unroll the loop:
Recurrent Neural Network - single character example
W = weight
H = hidden layer
x = input
y = output
t = time step
Recurrent Neural Network - the flow
Introducing Natural Language Processing (NLP) concepts
One-Hot Encoding
One hot encoding technique is used to encode categorical integer features using a
one-hot (also called one-of-K) scheme.
Example: Suppose you have 'color' feature which can take values 'white', 'red', and
'black' etc.
Logits
Logistic Function:
The logit function is the inverse of the
logistic function.
SoftMax
Multiclass Classification Model Output Layer.
The softmax activation function returns the probability distribution over mutually exclusive output classes.
Softmax is the function you will often find at the output layer of a classifier.
Scores Probabilities
2.0
1.0
0.1
0.7
0.2
0.1
Y Softmax (Y) y
2
y
1
y
3
LSTMs
Stands for Long Short-Term Memory Units (LSTMs).
This basically handles the problem of vanishing and exploding gradients. LSTMs help preserve the error
that can be backpropagated through time and layers.
Diagram (right): Illustrates how data flows through a memory cell
and is controlled by its gates:
Cross Entropy & Embeddings
Brief introduction to technologies used
TensorFlow
What is TensorFlow?
TensorFlow is an open source software library released in 2015 by Google to make
it easier for developers to design, build, and train deep learning models.
TensorFlow originated as an internal library that Google developers used to build
models in house, and we expect additional functionality to be added to the open
source version as they are tested and vetted in the internal flavor.
Why use: Thoughtful design & Ease of use
Some TensorFlow alternatives are: Theano, Torch, Caffe, Neon, and Keras
Variables in TensorFlow
TensorFlow variables are in-memory buffers that contain tensors, but unlike normal tensors that are only
instantiated when a graph is run and are immediately wiped clean afterwards, variables survive across
multiple executions of a graph. TensorFlow variables have the following three properties:
● Variables must be explicitly initialized before a graph is used for the first time
● We can use gradient methods to modify variables after each iteration as we search for a model’s
optimal parameter settings
● We can save the values stored in variables to disk and restore them for later use.
weights = tf.Variable(tf.random_normal([300, 200], stddev=0.5), name="weights", trainable=False)
#other methods to initialize a TensorFlow variable:
tf.zeros(shape, dtype=tf.float32, name=None)
tf.ones(shape, dtype=tf.float32, name=None)
tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)
tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)
tf.random_uniform(shape, minval=0, maxval=None, dtype=tf.float32, seed=None, name=None)
Operations in TensorFlow
● TensorFlow operations represent abstract transformations that are applied to tensors in the
computation graph.
● Operations may have attributes that may be supplied a priori or are inferred at runtime.
Category Examples
Element-wise mathematical operations Add, Sub, Mul, Div, Exp, Log, Greater, Less, Equal, ...
Array operations Concat, Slice, Split, Constant, Rank, Shape, Shuffle, ...
Matrix operations MatMul, MatrixInverse, MatrixDeterminant, ...
Stateful operations Variable, Assign, AssignAdd, ...
Neural network building blocks SoftMax, Sigmoid, ReLU, Convolution2D, MaxPool, ...
Checkpointing operations Save, Restore
Queue and synchronization operations Enqueue, Dequeue, MutexAcquire, MutexRelease, ...
Control flow operations Merge, Switch, Enter, Leave, NextIteration
Placeholder Tensors in TensorFlow
● A placeholder can be initialized every time, unlike variables
● This can be populated every single time the computation graph is run
x = tf.placeholder(tf.float32, name="x", shape=[None, 784])
W = tf.Variable(tf.random_uniform([784,10], -1, 1), name="W")
multiply = tf.matmul(x, W)
Sessions in TensorFlow
● A TensorFlow program interacts with a computation graph using a session.
● The TensorFlow session is responsible for building the initial graph, can be used to initialize all
variables appropriately, and to run the computational graph.
import tensorflow as tf
from read_data import get_minibatch()
x = tf.placeholder(tf.float32, name="x", shape=[None, 784])
W = tf.Variable(tf.random_uniform([784, 10], -1, 1), name="W")
b = tf.Variable(tf.zeros([10]), name="biases")
output = tf.matmul(x, W) + b
init_op = tf.initialize_all_variables()
sess = tf.Session()
sess.run(init_op)
feed_dict = {"x" : get_minibatch()}
sess.run(output, feed_dict=feed_dict)
FloydHub
What is FloydHub?
“Floydhub is Heroku for Deep Learning. A Platform-as-a-Service for training and
deploying your models in the cloud with a few simple commands.”
# Install locally and login
$pip install -U floyd-cli
$floyd login
# Run a Jupyter notebook on FloydHub
$ floyd run --mode jupyter --gpu
#Run a python code on GPU
$ floyd run --gpu "python mnist_cnn.py"
http://docs.floydhub.com/home/getting_started/
The solution: Language translation approach
Preprocess
Convert text into a number (ID)
Build the Network
Let us build the components necessary to build a Sequence-to-Sequence model by implementing the
following functions below:
● Model inputs
● Process decoding on the inputs
● Encoding layer
● Decoding layer
● Sequence to Sequence model
Language translation approach
Continued...
Tuning the following hyperparameters:
● Number of epochs
● Batch size
● Size of the RNNs
● Number of layers
● Size of the embedding for the encoder
● Size of the embedding for the decoder
● Learning rate
● Dropout keep probability
Hyperparameters
DEMO TIME
What next !
References
Books:
1. TensorFlow for Deep Learning (Nikhil Buduma, 8/2016), OReilly
2. Grokking Deep Learning (Andrew Trask, early 2018), Manning
3. Python: Deeper Insights into Machine Learning (Sebastian Raschka, 8/2016), Packt
Other:
1. Foundations of Deep Learning (Hugo Larochelle, Twitter) - https://youtu.be/zij_FTbJHsk
2. Deep Learning for Computer Vision (Andrej Karpathy, OpenAI) - https://youtu.be/u6aEYuemt0M
3. Deep Learning for Natural Language Processing (Richard Socher, Salesforce) - https://youtu.be/oGk1v1jQITw
4. TensorFlow Tutorial (Sherry Moore, Google Brain) - https://youtu.be/Ejec3ID_h0w
5. Foundations of Unsupervised Deep Learning (Ruslan Salakhutdinov, CMU) - https://youtu.be/rK6bchqeaN8
6. Nuts and Bolts of Applying Deep Learning (Andrew Ng) - https://youtu.be/F1ka6a13S9I
7. Deep Reinforcement Learning (John Schulman, OpenAI) - https://youtu.be/PtAIh9KSnjo
8. Theano Tutorial (Pascal Lamblin, MILA) - https://youtu.be/OU8I1oJ9HhI
9. Deep Learning for Speech Recognition (Adam Coates, Baidu) - https://youtu.be/g-sndkf7mCs
10. Torch Tutorial (Alex Wiltschko, Twitter) - https://youtu.be/L1sHcj3qDNc
11. Sequence to Sequence Deep Learning (Quoc Le, Google) - https://youtu.be/G5RY_SUJih4
12. Foundations and Challenges of Deep Learning (Yoshua Bengio) - https://youtu.be/11rsu_WwZTc
Questions

More Related Content

What's hot

Face recognition ppt
Face recognition pptFace recognition ppt
Face recognition pptSantosh Kumar
 
Verilog full adder in dataflow & gate level modelling style.
Verilog full adder in dataflow  & gate level modelling style.Verilog full adder in dataflow  & gate level modelling style.
Verilog full adder in dataflow & gate level modelling style.Omkar Rane
 
Speech recognition
Speech recognitionSpeech recognition
Speech recognitionCharu Joshi
 
Driver drowsiness monitoring system using visual behavior and Machine Learning.
Driver drowsiness monitoring system using visual behavior and Machine Learning.Driver drowsiness monitoring system using visual behavior and Machine Learning.
Driver drowsiness monitoring system using visual behavior and Machine Learning.AasimAhmedKhanJawaad
 
Mini Project on 4 BIT SERIAL MULTIPLIER
Mini Project on 4 BIT SERIAL MULTIPLIERMini Project on 4 BIT SERIAL MULTIPLIER
Mini Project on 4 BIT SERIAL MULTIPLIERj naga sai
 
Image Processing Based Signature Recognition and Verification Technique Using...
Image Processing Based Signature Recognition and Verification Technique Using...Image Processing Based Signature Recognition and Verification Technique Using...
Image Processing Based Signature Recognition and Verification Technique Using...Priyanka Pradhan
 
Sign Language Recognition based on Hands symbols Classification
Sign Language Recognition based on Hands symbols ClassificationSign Language Recognition based on Hands symbols Classification
Sign Language Recognition based on Hands symbols ClassificationTriloki Gupta
 
Smart Attendance System using RFID
Smart Attendance System using RFIDSmart Attendance System using RFID
Smart Attendance System using RFIDPratikdd
 
Human Activity Recognition
Human Activity RecognitionHuman Activity Recognition
Human Activity RecognitionAshwinGill1
 
Optical mouse working principle
Optical mouse working principleOptical mouse working principle
Optical mouse working principleanasibrahim2011411
 
Face recognition technology - BEST PPT
Face recognition technology - BEST PPTFace recognition technology - BEST PPT
Face recognition technology - BEST PPTSiddharth Modi
 
Face recognition technology
Face recognition technologyFace recognition technology
Face recognition technologyranjit banshpal
 
Group project dld assignement
Group project dld assignementGroup project dld assignement
Group project dld assignementAkhtarzeb Khan
 
Neural network & its applications
Neural network & its applications Neural network & its applications
Neural network & its applications Ahmed_hashmi
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gamemanika kumari
 
Deep Learning With Neural Networks
Deep Learning With Neural NetworksDeep Learning With Neural Networks
Deep Learning With Neural NetworksAniket Maurya
 
neural network
neural networkneural network
neural networkSTUDENT
 

What's hot (20)

Signature recognition
Signature recognitionSignature recognition
Signature recognition
 
Face recognition ppt
Face recognition pptFace recognition ppt
Face recognition ppt
 
Verilog full adder in dataflow & gate level modelling style.
Verilog full adder in dataflow  & gate level modelling style.Verilog full adder in dataflow  & gate level modelling style.
Verilog full adder in dataflow & gate level modelling style.
 
Speech recognition
Speech recognitionSpeech recognition
Speech recognition
 
Deep learning presentation
Deep learning presentationDeep learning presentation
Deep learning presentation
 
Driver drowsiness monitoring system using visual behavior and Machine Learning.
Driver drowsiness monitoring system using visual behavior and Machine Learning.Driver drowsiness monitoring system using visual behavior and Machine Learning.
Driver drowsiness monitoring system using visual behavior and Machine Learning.
 
Mini Project on 4 BIT SERIAL MULTIPLIER
Mini Project on 4 BIT SERIAL MULTIPLIERMini Project on 4 BIT SERIAL MULTIPLIER
Mini Project on 4 BIT SERIAL MULTIPLIER
 
Deep learning
Deep learningDeep learning
Deep learning
 
Image Processing Based Signature Recognition and Verification Technique Using...
Image Processing Based Signature Recognition and Verification Technique Using...Image Processing Based Signature Recognition and Verification Technique Using...
Image Processing Based Signature Recognition and Verification Technique Using...
 
Sign Language Recognition based on Hands symbols Classification
Sign Language Recognition based on Hands symbols ClassificationSign Language Recognition based on Hands symbols Classification
Sign Language Recognition based on Hands symbols Classification
 
Smart Attendance System using RFID
Smart Attendance System using RFIDSmart Attendance System using RFID
Smart Attendance System using RFID
 
Human Activity Recognition
Human Activity RecognitionHuman Activity Recognition
Human Activity Recognition
 
Optical mouse working principle
Optical mouse working principleOptical mouse working principle
Optical mouse working principle
 
Face recognition technology - BEST PPT
Face recognition technology - BEST PPTFace recognition technology - BEST PPT
Face recognition technology - BEST PPT
 
Face recognition technology
Face recognition technologyFace recognition technology
Face recognition technology
 
Group project dld assignement
Group project dld assignementGroup project dld assignement
Group project dld assignement
 
Neural network & its applications
Neural network & its applications Neural network & its applications
Neural network & its applications
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe game
 
Deep Learning With Neural Networks
Deep Learning With Neural NetworksDeep Learning With Neural Networks
Deep Learning With Neural Networks
 
neural network
neural networkneural network
neural network
 

Similar to Language translation with Deep Learning (RNN) with TensorFlow

A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...Databricks
 
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...ETS Asset Management Factory
 
Deep Learning in your Browser: powered by WebGL
Deep Learning in your Browser: powered by WebGLDeep Learning in your Browser: powered by WebGL
Deep Learning in your Browser: powered by WebGLOswald Campesato
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Ganesan Narayanasamy
 
TensorFlow for IITians
TensorFlow for IITiansTensorFlow for IITians
TensorFlow for IITiansAshish Bansal
 
Deep Learning and TensorFlow
Deep Learning and TensorFlowDeep Learning and TensorFlow
Deep Learning and TensorFlowOswald Campesato
 
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...AI Frontiers
 
TensorFlow in Your Browser
TensorFlow in Your BrowserTensorFlow in Your Browser
TensorFlow in Your BrowserOswald Campesato
 
Introduction To Using TensorFlow & Deep Learning
Introduction To Using TensorFlow & Deep LearningIntroduction To Using TensorFlow & Deep Learning
Introduction To Using TensorFlow & Deep Learningali alemi
 
Deep Learning in Your Browser
Deep Learning in Your BrowserDeep Learning in Your Browser
Deep Learning in Your BrowserOswald Campesato
 
Introduction to Tensor Flow for Optical Character Recognition (OCR)
Introduction to Tensor Flow for Optical Character Recognition (OCR)Introduction to Tensor Flow for Optical Character Recognition (OCR)
Introduction to Tensor Flow for Optical Character Recognition (OCR)Vincenzo Santopietro
 
Introduction to Deep Learning, Keras, and Tensorflow
Introduction to Deep Learning, Keras, and TensorflowIntroduction to Deep Learning, Keras, and Tensorflow
Introduction to Deep Learning, Keras, and TensorflowOswald Campesato
 
Introduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlowIntroduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlowSri Ambati
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usagehyunyoung Lee
 
Introduction to Deep Learning and TensorFlow
Introduction to Deep Learning and TensorFlowIntroduction to Deep Learning and TensorFlow
Introduction to Deep Learning and TensorFlowOswald Campesato
 
Introduction to Neural Networks in Tensorflow
Introduction to Neural Networks in TensorflowIntroduction to Neural Networks in Tensorflow
Introduction to Neural Networks in TensorflowNicholas McClure
 
Intro to Deep Learning, TensorFlow, and tensorflow.js
Intro to Deep Learning, TensorFlow, and tensorflow.jsIntro to Deep Learning, TensorFlow, and tensorflow.js
Intro to Deep Learning, TensorFlow, and tensorflow.jsOswald Campesato
 
deepnet-lourentzou.ppt
deepnet-lourentzou.pptdeepnet-lourentzou.ppt
deepnet-lourentzou.pptyang947066
 
Introduction To Tensorflow
Introduction To TensorflowIntroduction To Tensorflow
Introduction To TensorflowRayyan Khalid
 

Similar to Language translation with Deep Learning (RNN) with TensorFlow (20)

A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
 
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...
Python + Tensorflow: how to earn money in the Stock Exchange with Deep Learni...
 
Deep Learning in your Browser: powered by WebGL
Deep Learning in your Browser: powered by WebGLDeep Learning in your Browser: powered by WebGL
Deep Learning in your Browser: powered by WebGL
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
 
TensorFlow for IITians
TensorFlow for IITiansTensorFlow for IITians
TensorFlow for IITians
 
Deep Learning and TensorFlow
Deep Learning and TensorFlowDeep Learning and TensorFlow
Deep Learning and TensorFlow
 
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...
Training at AI Frontiers 2018 - Lukasz Kaiser: Sequence to Sequence Learning ...
 
TensorFlow in Your Browser
TensorFlow in Your BrowserTensorFlow in Your Browser
TensorFlow in Your Browser
 
Introduction To Using TensorFlow & Deep Learning
Introduction To Using TensorFlow & Deep LearningIntroduction To Using TensorFlow & Deep Learning
Introduction To Using TensorFlow & Deep Learning
 
Deep Learning in Your Browser
Deep Learning in Your BrowserDeep Learning in Your Browser
Deep Learning in Your Browser
 
Introduction to Tensor Flow for Optical Character Recognition (OCR)
Introduction to Tensor Flow for Optical Character Recognition (OCR)Introduction to Tensor Flow for Optical Character Recognition (OCR)
Introduction to Tensor Flow for Optical Character Recognition (OCR)
 
Introduction to Deep Learning, Keras, and Tensorflow
Introduction to Deep Learning, Keras, and TensorflowIntroduction to Deep Learning, Keras, and Tensorflow
Introduction to Deep Learning, Keras, and Tensorflow
 
Introduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlowIntroduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlow
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usage
 
Introduction to Deep Learning and TensorFlow
Introduction to Deep Learning and TensorFlowIntroduction to Deep Learning and TensorFlow
Introduction to Deep Learning and TensorFlow
 
Introduction to Neural Networks in Tensorflow
Introduction to Neural Networks in TensorflowIntroduction to Neural Networks in Tensorflow
Introduction to Neural Networks in Tensorflow
 
Intro to Deep Learning, TensorFlow, and tensorflow.js
Intro to Deep Learning, TensorFlow, and tensorflow.jsIntro to Deep Learning, TensorFlow, and tensorflow.js
Intro to Deep Learning, TensorFlow, and tensorflow.js
 
deepnet-lourentzou.ppt
deepnet-lourentzou.pptdeepnet-lourentzou.ppt
deepnet-lourentzou.ppt
 
H2 o berkeleydltf
H2 o berkeleydltfH2 o berkeleydltf
H2 o berkeleydltf
 
Introduction To Tensorflow
Introduction To TensorflowIntroduction To Tensorflow
Introduction To Tensorflow
 

Recently uploaded

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Recently uploaded (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 

Language translation with Deep Learning (RNN) with TensorFlow

  • 1. Language Translation with Deep Learning Using TensorFlow on FloydHub
  • 2. About me Machine Learning and Big Data Architect MS Computer Science, Machine Learning, Georgia Tech Deep Learning Nanodegree, Udacity Artificial Intelligence Nanodegree, Udacity Connect Twitter : @techmazed LinkedIn : https://www.linkedin.com/in/knownasar
  • 3. ● This is a group for anyone interested in AI, Machine Learning, Deep Learning, NLP, Deep RL, Image Recognition, Speech Recognition etc. ● All backgrounds are welcome! ● This group is created in order to bring AI enthusiasts together, build the leading AI community and move forward the research and technology advancement in the AI related subfields. Join the conversations at Meetup Group: https://www.meetup.com/Nashville-Artificial-Intelligence-Society/ LinkedIn Group: https://www.linkedin.com/groups/12043828 Twitter: @AINashville (https://twitter.com/AInashville) p.s. We are currently looking for venue Sponsors! About Nashville AI Society Meetup
  • 4. ● The Language Translation challenge ● Introducing Deep Learning ● Introducing RNN ● Introducing NLP concepts ● Brief introduction to TensorFlow & FloydHub ● The solution approach ● Demo time and code walkthrough ● What next! ● Question time What we’ll cover
  • 6. We will be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French We use a small portion of the English & French corpus Language translation challenge English: new jersey is sometimes quiet during autumn , and it is snowy in april . French: new jersey est parfois calme pendant l' automne , et il est neigeux en avril .
  • 8. Field of Deep Learning Buckets of DL
  • 9. Deep Learning vs Traditional Algorithms Data vs Performance Source: https://www.youtube.com/watch?v=F1ka6a13S9I
  • 10. What is Deep Learning Neural networks with large number of parameters and layers. The layers belong to one of four fundamental network architectures: ● Unsupervised Pre-Trained Networks ● Convolutional Neural Networks ● Recurrent Neural Networks ● Recursive Neural Networks A neural Network is an algorithm that learns to identify patterns in data Backpropagation is a technique to train a Neural Net by updating weights via gradient descent Deep Learning : many layer neural net + massive data (big data) + massive compute (GPU)
  • 11. Multi-Layer Neural Network topology The behavior of neural networks is shaped by its network architecture. A network’s architecture can be defined, in part, by: ● number of neurons ● number of layers ● types of connections between layers
  • 12. Backpropagation Learning Backpropagation is an important part of reducing error in a neural network model. function neural-network-learning( training-records ) returns network network <- initialize weights (randomly) start loop for each example in training-records do network-output = neural-network-output( network, example ) actual-output = observed outcome associated with example update weights in network based on { example, network-output, actual-output } end for end loop when all examples correctly predicted or hit stopping conditions return network General Neural Network Training Pseudocode
  • 14. What is RNN? They are networks with loops in them, allowing information to persist. Recurrent Neural Networks have loops. In the above diagram, a chunk of neural network, A, looks at some input xt and outputs a value ht. A loop allows information to be passed from one step of the network to the next. A recurrent neural network can be thought of as multiple copies of the same network, each passing a message to a successor. Consider what happens if we unroll the loop:
  • 15. Recurrent Neural Network - single character example W = weight H = hidden layer x = input y = output t = time step
  • 17. Introducing Natural Language Processing (NLP) concepts
  • 18. One-Hot Encoding One hot encoding technique is used to encode categorical integer features using a one-hot (also called one-of-K) scheme. Example: Suppose you have 'color' feature which can take values 'white', 'red', and 'black' etc.
  • 19. Logits Logistic Function: The logit function is the inverse of the logistic function.
  • 20. SoftMax Multiclass Classification Model Output Layer. The softmax activation function returns the probability distribution over mutually exclusive output classes. Softmax is the function you will often find at the output layer of a classifier. Scores Probabilities 2.0 1.0 0.1 0.7 0.2 0.1 Y Softmax (Y) y 2 y 1 y 3
  • 21. LSTMs Stands for Long Short-Term Memory Units (LSTMs). This basically handles the problem of vanishing and exploding gradients. LSTMs help preserve the error that can be backpropagated through time and layers. Diagram (right): Illustrates how data flows through a memory cell and is controlled by its gates:
  • 22. Cross Entropy & Embeddings
  • 23. Brief introduction to technologies used
  • 25. What is TensorFlow? TensorFlow is an open source software library released in 2015 by Google to make it easier for developers to design, build, and train deep learning models. TensorFlow originated as an internal library that Google developers used to build models in house, and we expect additional functionality to be added to the open source version as they are tested and vetted in the internal flavor. Why use: Thoughtful design & Ease of use Some TensorFlow alternatives are: Theano, Torch, Caffe, Neon, and Keras
  • 26. Variables in TensorFlow TensorFlow variables are in-memory buffers that contain tensors, but unlike normal tensors that are only instantiated when a graph is run and are immediately wiped clean afterwards, variables survive across multiple executions of a graph. TensorFlow variables have the following three properties: ● Variables must be explicitly initialized before a graph is used for the first time ● We can use gradient methods to modify variables after each iteration as we search for a model’s optimal parameter settings ● We can save the values stored in variables to disk and restore them for later use. weights = tf.Variable(tf.random_normal([300, 200], stddev=0.5), name="weights", trainable=False) #other methods to initialize a TensorFlow variable: tf.zeros(shape, dtype=tf.float32, name=None) tf.ones(shape, dtype=tf.float32, name=None) tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None) tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None) tf.random_uniform(shape, minval=0, maxval=None, dtype=tf.float32, seed=None, name=None)
  • 27. Operations in TensorFlow ● TensorFlow operations represent abstract transformations that are applied to tensors in the computation graph. ● Operations may have attributes that may be supplied a priori or are inferred at runtime. Category Examples Element-wise mathematical operations Add, Sub, Mul, Div, Exp, Log, Greater, Less, Equal, ... Array operations Concat, Slice, Split, Constant, Rank, Shape, Shuffle, ... Matrix operations MatMul, MatrixInverse, MatrixDeterminant, ... Stateful operations Variable, Assign, AssignAdd, ... Neural network building blocks SoftMax, Sigmoid, ReLU, Convolution2D, MaxPool, ... Checkpointing operations Save, Restore Queue and synchronization operations Enqueue, Dequeue, MutexAcquire, MutexRelease, ... Control flow operations Merge, Switch, Enter, Leave, NextIteration
  • 28. Placeholder Tensors in TensorFlow ● A placeholder can be initialized every time, unlike variables ● This can be populated every single time the computation graph is run x = tf.placeholder(tf.float32, name="x", shape=[None, 784]) W = tf.Variable(tf.random_uniform([784,10], -1, 1), name="W") multiply = tf.matmul(x, W)
  • 29. Sessions in TensorFlow ● A TensorFlow program interacts with a computation graph using a session. ● The TensorFlow session is responsible for building the initial graph, can be used to initialize all variables appropriately, and to run the computational graph. import tensorflow as tf from read_data import get_minibatch() x = tf.placeholder(tf.float32, name="x", shape=[None, 784]) W = tf.Variable(tf.random_uniform([784, 10], -1, 1), name="W") b = tf.Variable(tf.zeros([10]), name="biases") output = tf.matmul(x, W) + b init_op = tf.initialize_all_variables() sess = tf.Session() sess.run(init_op) feed_dict = {"x" : get_minibatch()} sess.run(output, feed_dict=feed_dict)
  • 31. What is FloydHub? “Floydhub is Heroku for Deep Learning. A Platform-as-a-Service for training and deploying your models in the cloud with a few simple commands.” # Install locally and login $pip install -U floyd-cli $floyd login # Run a Jupyter notebook on FloydHub $ floyd run --mode jupyter --gpu #Run a python code on GPU $ floyd run --gpu "python mnist_cnn.py" http://docs.floydhub.com/home/getting_started/
  • 32. The solution: Language translation approach
  • 33. Preprocess Convert text into a number (ID) Build the Network Let us build the components necessary to build a Sequence-to-Sequence model by implementing the following functions below: ● Model inputs ● Process decoding on the inputs ● Encoding layer ● Decoding layer ● Sequence to Sequence model Language translation approach Continued...
  • 34. Tuning the following hyperparameters: ● Number of epochs ● Batch size ● Size of the RNNs ● Number of layers ● Size of the embedding for the encoder ● Size of the embedding for the decoder ● Learning rate ● Dropout keep probability Hyperparameters
  • 37. References Books: 1. TensorFlow for Deep Learning (Nikhil Buduma, 8/2016), OReilly 2. Grokking Deep Learning (Andrew Trask, early 2018), Manning 3. Python: Deeper Insights into Machine Learning (Sebastian Raschka, 8/2016), Packt Other: 1. Foundations of Deep Learning (Hugo Larochelle, Twitter) - https://youtu.be/zij_FTbJHsk 2. Deep Learning for Computer Vision (Andrej Karpathy, OpenAI) - https://youtu.be/u6aEYuemt0M 3. Deep Learning for Natural Language Processing (Richard Socher, Salesforce) - https://youtu.be/oGk1v1jQITw 4. TensorFlow Tutorial (Sherry Moore, Google Brain) - https://youtu.be/Ejec3ID_h0w 5. Foundations of Unsupervised Deep Learning (Ruslan Salakhutdinov, CMU) - https://youtu.be/rK6bchqeaN8 6. Nuts and Bolts of Applying Deep Learning (Andrew Ng) - https://youtu.be/F1ka6a13S9I 7. Deep Reinforcement Learning (John Schulman, OpenAI) - https://youtu.be/PtAIh9KSnjo 8. Theano Tutorial (Pascal Lamblin, MILA) - https://youtu.be/OU8I1oJ9HhI 9. Deep Learning for Speech Recognition (Adam Coates, Baidu) - https://youtu.be/g-sndkf7mCs 10. Torch Tutorial (Alex Wiltschko, Twitter) - https://youtu.be/L1sHcj3qDNc 11. Sequence to Sequence Deep Learning (Quoc Le, Google) - https://youtu.be/G5RY_SUJih4 12. Foundations and Challenges of Deep Learning (Yoshua Bengio) - https://youtu.be/11rsu_WwZTc