SlideShare a Scribd company logo
TensorFlow & Keras
Deep Learning Framework
Overview: TensorFlow
What is TensorFlow?
• URL: https://www.tensorflow.org/
• Released under the open source license on
November 9, 2015
• Current version 1.2
• Open source software library for numerical
computation using data flow graphs
• Originally developed by Google Brain Team to
conduct machine learning and deep neural
networks research
• General enough to be applicable in a wide
variety of other domains as well
• TensorFlow provides an extensive suite of
functions and classes that allow users to build
various models from scratch.
Most popular on Github
https://github.com/tensorflow/tensorflow
TensorFlow architecture
• Core in C++
• Low overhead
• Different front ends for specifying/driving the computation
• Python, C++, R and many more
CPU - GPU
• In TensorFlow, the
supported device types
are CPU and GPU. They are
represented as strings. For
example:
• "/cpu:0": The CPU of your
machine.
• "/gpu:0": The GPU of
your machine, if you have one.
• "/gpu:1": The second
GPU of your machine, etc.
What is a Tensor?
Why it is called TensorFlow?
● TensorFlow is based on computation
data flow graph
● TensorFlow separates definition of
computations from their execution
TensorFlow Graph
Learn Parameters: Optimization
● The Optimizer base class provides
methods to compute gradients for a loss
and apply gradients to variables.
● A collection of subclasses implement
classic optimization algorithms such as
GradientDescent and Adagrad.
● TensorFlow provides functions to
compute the derivatives for a given
TensorFlow computation graph, adding
operations to the graph.
Learn Parameters: Optimization
TensorBoard
• Visualize your TensorFlow
graph
• Plot quantitative metrics about
the execution of your graph
• Show additional data like
images that pass through it
TensorFlow Models
https://github.com/tensorflow/models
Models
• adversarial_crypto: protecting communications with adversarial neural cryptography.
• adversarial_text: semi-supervised sequence learning with adversarial training.
• attention_ocr: a model for real-world image text extraction.
• autoencoder: various autoencoders.
• cognitive_mapping_and_planning: implementation of a spatial memory based mapping and planning
architecture for visual navigation.
• compression: compressing and decompressing images using a pre-trained Residual GRU network.
• differential_privacy: privacy-preserving student models from multiple teachers.
• domain_adaptation: domain separation networks.
• im2txt: image-to-text neural network for image captioning.
• inception: deep convolutional networks for computer vision.
TensorFlow Serving
•Flexible, high-performance
serving system for machine
learning models, designed for
production environments.
•Easy to deploy new algorithms
and experiments, while
keeping the same server
architecture and APIs
Code snippet
import tensorflow as tf
# build a linear model where y = w * x + b
w = tf.Variable([0.2], tf.float32, name='weight')
b = tf.Variable([0.3], tf.float32, name='bias')
X = tf.placeholder(tf.float32, name="X")
Y = tf.placeholder(tf.float32, name='Y')
# the training values for x and y
x = ([2.,3.,4.,5.])
y = ([-1.,-2.,-3.,-4.])
# define the linear model
linear_model = w*X+b
# define the loss function
square_delta = tf.square(linear_model - Y)
loss = tf.reduce_sum(square_delta)
#set the learning rate and training epoch
learning_rate = 0.01
training_epoch = 1000
# optimizer
optimizer = tf.train.GradientDescentOptimizer(learning_rate)
train = optimizer.minimize(loss)
# start a session
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
for i in range(training_epoch):
sess.run(train, feed_dict={X:x,Y:y})
# evaluate training accuracy
curr_w, curr_b, curr_loss = sess.run([w, b, loss], {X:x,Y:y})
print('w: %f b: %f loss: %f '%(curr_w, curr_b, curr_loss))
TensorFlow: Installation
• pip3 install tensorflow
or
• Anaconda: conda install -c conda-forge tensorflow
Overview: Keras
Keras
•https://keras.io/
•Minimalist, highly modular neural
networks library
•Written in Python
•Capable of running on top of either
TensorFlow/Theano and CNTK
•Developed with a focus on enabling
fast experimentation
Guiding Principles
•Modularity
• A model is understood as a sequence or a graph of standalone,
fully-configurable modules that can be plugged together with as little
restrictions as possible
•Minimalism
• Each module should be kept short and simple
•Easy extensibility
• New modules can be easily added and extended
•Python
• Supports Python
General Design
•General idea is to based on layers and their input/output
• Prepare your inputs and output tensors
• Create first layer to handle input tensor
• Create output layer to handle targets
• Build virtually any model you like in between
Layers
•Keras has a number of pre-built layers. Notable examples include:
• Regular dense, MLP type
keras.layers.core.Dense(units, activation=None, use_bias=True,
kernel_initializer='glorot_uniform', bias_initializer='zeros',
kernel_regularizer=None, bias_regularizer=None,
activity_regularizer=None, kernel_constraint=None, bias_constraint=None)
• Recurrent layers, LTSM, GRU, etc
keras.layers.recurrent.Recurrent(return_sequences=False,
return_state=False, go_backwards=False, stateful=False, unroll=False,
implementation=0)
Layers
• 1D Convolutional layers
keras.layers.convolutional.Conv1D(filters, kernel_size, strides=1, padding='valid',
dilation_rate=1, activation=None, use_bias=True, kernel_initializer='glorot_uniform',
bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None,
activity_regularizer=None, kernel_constraint=None, bias_constraint=None)
• 2D Convolutional layers
keras.layers.convolutional.Conv2D(filters, kernel_size, strides=(1, 1), padding='valid',
data_format=None, dilation_rate=(1, 1), activation=None, use_bias=True,
kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None,
bias_regularizer=None, activity_regularizer=None, kernel_constraint=None,
bias_constraint=None)
Why use Keras?
•Easy and fast prototyping (through total modularity, minimalism, and
extensibility).
•Supports both convolutional networks and recurrent networks and
combinations of the two.
•Supports arbitrary connectivity schemes (including multi-input and
multi-output training).
•Runs seamlessly on CPU and GPU.
Keras Code examples
•The core data structure of Keras is a model
•Model → a way to organize layers
Model
Sequential Graph
Code-snippet
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
from keras.optimizers import SGD
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])
model = Sequential()
model.add(Dense(2, input_dim=2, activation='sigmoid'))
model.add(Dense(1, activation='sigmoid'))
sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='mean_squared_error', optimizer=sgd)
history = model.fit(X, y, nb_epoch=10000, batch_size=4)
Keras: Installation
• Theano :
• pip3 install Theano
• CNTK
• $ export CNTK_BINARY_URL=... [choose link here]
• pip3 install $CNTK_BINARY_URL
• TensorFlow :
• $ export TF_BINARY_URL=... [choose link here]
• pip3 install $TF_BINARY_URL
• Keras :
• pip3 install keras
• To enable GPU computing :
• NVidia Cuda
• CuDNN
• CNMeM
Demo
Slides & Codes available from Github:
https://github.com/kuanhoong/Magic_DeepLearning
Ad

More Related Content

What's hot (20)

Introduction To TensorFlow
Introduction To TensorFlowIntroduction To TensorFlow
Introduction To TensorFlow
Spotle.ai
 
Getting started with TensorFlow
Getting started with TensorFlowGetting started with TensorFlow
Getting started with TensorFlow
ElifTech
 
Tensorflow
TensorflowTensorflow
Tensorflow
marwa Ayad Mohamed
 
Tensorflow presentation
Tensorflow presentationTensorflow presentation
Tensorflow presentation
Ahmed rebai
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Larry Guo
 
An introduction to Deep Learning
An introduction to Deep LearningAn introduction to Deep Learning
An introduction to Deep Learning
Julien SIMON
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
SomnathMore3
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
Sopheaktra YONG
 
Pytorch
PytorchPytorch
Pytorch
ehsan tr
 
Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0
Databricks
 
Training Neural Networks
Training Neural NetworksTraining Neural Networks
Training Neural Networks
Databricks
 
Keras and TensorFlow
Keras and TensorFlowKeras and TensorFlow
Keras and TensorFlow
NopphawanTamkuan
 
Bert
BertBert
Bert
Abdallah Bashir
 
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Edureka!
 
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
Simplilearn
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
Christian Perone
 
Introduction to keras
Introduction to kerasIntroduction to keras
Introduction to keras
Haritha Thilakarathne
 
Introduction to Recurrent Neural Network
Introduction to Recurrent Neural NetworkIntroduction to Recurrent Neural Network
Introduction to Recurrent Neural Network
Yan Xu
 
Introduction to deep learning
Introduction to deep learningIntroduction to deep learning
Introduction to deep learning
Junaid Bhat
 
Deep learning ppt
Deep learning pptDeep learning ppt
Deep learning ppt
BalneSridevi
 
Introduction To TensorFlow
Introduction To TensorFlowIntroduction To TensorFlow
Introduction To TensorFlow
Spotle.ai
 
Getting started with TensorFlow
Getting started with TensorFlowGetting started with TensorFlow
Getting started with TensorFlow
ElifTech
 
Tensorflow presentation
Tensorflow presentationTensorflow presentation
Tensorflow presentation
Ahmed rebai
 
Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10) Deep Learning: Recurrent Neural Network (Chapter 10)
Deep Learning: Recurrent Neural Network (Chapter 10)
Larry Guo
 
An introduction to Deep Learning
An introduction to Deep LearningAn introduction to Deep Learning
An introduction to Deep Learning
Julien SIMON
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
SomnathMore3
 
Feedforward neural network
Feedforward neural networkFeedforward neural network
Feedforward neural network
Sopheaktra YONG
 
Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0Introduction to TensorFlow 2.0
Introduction to TensorFlow 2.0
Databricks
 
Training Neural Networks
Training Neural NetworksTraining Neural Networks
Training Neural Networks
Databricks
 
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In P...
Edureka!
 
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
TensorFlow Tutorial | Deep Learning With TensorFlow | TensorFlow Tutorial For...
Simplilearn
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
Christian Perone
 
Introduction to Recurrent Neural Network
Introduction to Recurrent Neural NetworkIntroduction to Recurrent Neural Network
Introduction to Recurrent Neural Network
Yan Xu
 
Introduction to deep learning
Introduction to deep learningIntroduction to deep learning
Introduction to deep learning
Junaid Bhat
 

Similar to TensorFlow and Keras: An Overview (20)

CI-Keras for deep learning by adrian.pdf
CI-Keras for deep learning by adrian.pdfCI-Keras for deep learning by adrian.pdf
CI-Keras for deep learning by adrian.pdf
sakshamagarwalm2
 
Introduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptxIntroduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptx
Janagi Raman S
 
unit-iii-deep-learningunit-iii-deep-learning.pdf
unit-iii-deep-learningunit-iii-deep-learning.pdfunit-iii-deep-learningunit-iii-deep-learning.pdf
unit-iii-deep-learningunit-iii-deep-learning.pdf
nandan543979
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlow
Darshan Patel
 
dl-unit-3 materialdl-unit-3 material.pdf
dl-unit-3 materialdl-unit-3 material.pdfdl-unit-3 materialdl-unit-3 material.pdf
dl-unit-3 materialdl-unit-3 material.pdf
nandan543979
 
KERAS Python Tutorial
KERAS Python TutorialKERAS Python Tutorial
KERAS Python Tutorial
MahmutKAMALAK
 
Netflix machine learning
Netflix machine learningNetflix machine learning
Netflix machine learning
Amer Ather
 
Neural Networks from Scratch - TensorFlow 101
Neural Networks from Scratch - TensorFlow 101Neural Networks from Scratch - TensorFlow 101
Neural Networks from Scratch - TensorFlow 101
Gerold Bausch
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob KaralusDistributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Jakob Karalus
 
Keras: Deep Learning Library for Python
Keras: Deep Learning Library for PythonKeras: Deep Learning Library for Python
Keras: Deep Learning Library for Python
Rafi Khan
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of view
Pierre Paci
 
Tensorflow on Android
Tensorflow on AndroidTensorflow on Android
Tensorflow on Android
Koan-Sin Tan
 
CoreML
CoreMLCoreML
CoreML
Ali Akhtar
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# Way
Bishnu Rawal
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
Travis Oliphant
 
Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU
Andrés Leonardo Martinez Ortiz
 
Introduction to TensorFlow Lite
Introduction to TensorFlow Lite Introduction to TensorFlow Lite
Introduction to TensorFlow Lite
Koan-Sin Tan
 
Python Keras module for advanced python programming
Python Keras module for advanced python programmingPython Keras module for advanced python programming
Python Keras module for advanced python programming
AnaswaraKU
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versa
Brendan Gregg
 
Getting started with neural networks (NNs)
Getting started with neural networks (NNs)Getting started with neural networks (NNs)
Getting started with neural networks (NNs)
Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt
 
CI-Keras for deep learning by adrian.pdf
CI-Keras for deep learning by adrian.pdfCI-Keras for deep learning by adrian.pdf
CI-Keras for deep learning by adrian.pdf
sakshamagarwalm2
 
Introduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptxIntroduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptx
Janagi Raman S
 
unit-iii-deep-learningunit-iii-deep-learning.pdf
unit-iii-deep-learningunit-iii-deep-learning.pdfunit-iii-deep-learningunit-iii-deep-learning.pdf
unit-iii-deep-learningunit-iii-deep-learning.pdf
nandan543979
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlow
Darshan Patel
 
dl-unit-3 materialdl-unit-3 material.pdf
dl-unit-3 materialdl-unit-3 material.pdfdl-unit-3 materialdl-unit-3 material.pdf
dl-unit-3 materialdl-unit-3 material.pdf
nandan543979
 
KERAS Python Tutorial
KERAS Python TutorialKERAS Python Tutorial
KERAS Python Tutorial
MahmutKAMALAK
 
Netflix machine learning
Netflix machine learningNetflix machine learning
Netflix machine learning
Amer Ather
 
Neural Networks from Scratch - TensorFlow 101
Neural Networks from Scratch - TensorFlow 101Neural Networks from Scratch - TensorFlow 101
Neural Networks from Scratch - TensorFlow 101
Gerold Bausch
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob KaralusDistributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Jakob Karalus
 
Keras: Deep Learning Library for Python
Keras: Deep Learning Library for PythonKeras: Deep Learning Library for Python
Keras: Deep Learning Library for Python
Rafi Khan
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of view
Pierre Paci
 
Tensorflow on Android
Tensorflow on AndroidTensorflow on Android
Tensorflow on Android
Koan-Sin Tan
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# Way
Bishnu Rawal
 
Introduction to TensorFlow Lite
Introduction to TensorFlow Lite Introduction to TensorFlow Lite
Introduction to TensorFlow Lite
Koan-Sin Tan
 
Python Keras module for advanced python programming
Python Keras module for advanced python programmingPython Keras module for advanced python programming
Python Keras module for advanced python programming
AnaswaraKU
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versa
Brendan Gregg
 
Ad

More from Poo Kuan Hoong (20)

Build an efficient Machine Learning model with LightGBM
Build an efficient Machine Learning model with LightGBMBuild an efficient Machine Learning model with LightGBM
Build an efficient Machine Learning model with LightGBM
Poo Kuan Hoong
 
Tensor flow 2.0 what's new
Tensor flow 2.0  what's newTensor flow 2.0  what's new
Tensor flow 2.0 what's new
Poo Kuan Hoong
 
The future outlook and the path to be Data Scientist
The future outlook and the path to be Data ScientistThe future outlook and the path to be Data Scientist
The future outlook and the path to be Data Scientist
Poo Kuan Hoong
 
Data Driven Organization and Data Commercialization
Data Driven Organization and Data CommercializationData Driven Organization and Data Commercialization
Data Driven Organization and Data Commercialization
Poo Kuan Hoong
 
Explore and Have Fun with TensorFlow: Transfer Learning
Explore and Have Fun with TensorFlow: Transfer LearningExplore and Have Fun with TensorFlow: Transfer Learning
Explore and Have Fun with TensorFlow: Transfer Learning
Poo Kuan Hoong
 
Deep Learning with R
Deep Learning with RDeep Learning with R
Deep Learning with R
Poo Kuan Hoong
 
Explore and have fun with TensorFlow: An introductory to TensorFlow
Explore and have fun with TensorFlow: An introductory	to TensorFlowExplore and have fun with TensorFlow: An introductory	to TensorFlow
Explore and have fun with TensorFlow: An introductory to TensorFlow
Poo Kuan Hoong
 
The path to be a Data Scientist
The path to be a Data ScientistThe path to be a Data Scientist
The path to be a Data Scientist
Poo Kuan Hoong
 
Deep Learning with Microsoft R Open
Deep Learning with Microsoft R OpenDeep Learning with Microsoft R Open
Deep Learning with Microsoft R Open
Poo Kuan Hoong
 
Microsoft APAC Machine Learning & Data Science Community Bootcamp
Microsoft APAC Machine Learning & Data Science Community BootcampMicrosoft APAC Machine Learning & Data Science Community Bootcamp
Microsoft APAC Machine Learning & Data Science Community Bootcamp
Poo Kuan Hoong
 
Customer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R OpenCustomer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R Open
Poo Kuan Hoong
 
Machine Learning and Deep Learning with R
Machine Learning and Deep Learning with RMachine Learning and Deep Learning with R
Machine Learning and Deep Learning with R
Poo Kuan Hoong
 
The path to be a data scientist
The path to be a data scientistThe path to be a data scientist
The path to be a data scientist
Poo Kuan Hoong
 
MDEC Data Matters Series: machine learning and Deep Learning, A Primer
MDEC Data Matters Series: machine learning and Deep Learning, A PrimerMDEC Data Matters Series: machine learning and Deep Learning, A Primer
MDEC Data Matters Series: machine learning and Deep Learning, A Primer
Poo Kuan Hoong
 
Big Data Malaysia - A Primer on Deep Learning
Big Data Malaysia - A Primer on Deep LearningBig Data Malaysia - A Primer on Deep Learning
Big Data Malaysia - A Primer on Deep Learning
Poo Kuan Hoong
 
Handwritten Recognition using Deep Learning with R
Handwritten Recognition using Deep Learning with RHandwritten Recognition using Deep Learning with R
Handwritten Recognition using Deep Learning with R
Poo Kuan Hoong
 
An Introduction to Deep Learning
An Introduction to Deep LearningAn Introduction to Deep Learning
An Introduction to Deep Learning
Poo Kuan Hoong
 
Machine learning and big data
Machine learning and big dataMachine learning and big data
Machine learning and big data
Poo Kuan Hoong
 
DSRLab seminar Introduction to deep learning
DSRLab seminar   Introduction to deep learningDSRLab seminar   Introduction to deep learning
DSRLab seminar Introduction to deep learning
Poo Kuan Hoong
 
Context Aware Road Traffic Speech Information System from Social Media
Context Aware Road Traffic Speech Information System from Social MediaContext Aware Road Traffic Speech Information System from Social Media
Context Aware Road Traffic Speech Information System from Social Media
Poo Kuan Hoong
 
Build an efficient Machine Learning model with LightGBM
Build an efficient Machine Learning model with LightGBMBuild an efficient Machine Learning model with LightGBM
Build an efficient Machine Learning model with LightGBM
Poo Kuan Hoong
 
Tensor flow 2.0 what's new
Tensor flow 2.0  what's newTensor flow 2.0  what's new
Tensor flow 2.0 what's new
Poo Kuan Hoong
 
The future outlook and the path to be Data Scientist
The future outlook and the path to be Data ScientistThe future outlook and the path to be Data Scientist
The future outlook and the path to be Data Scientist
Poo Kuan Hoong
 
Data Driven Organization and Data Commercialization
Data Driven Organization and Data CommercializationData Driven Organization and Data Commercialization
Data Driven Organization and Data Commercialization
Poo Kuan Hoong
 
Explore and Have Fun with TensorFlow: Transfer Learning
Explore and Have Fun with TensorFlow: Transfer LearningExplore and Have Fun with TensorFlow: Transfer Learning
Explore and Have Fun with TensorFlow: Transfer Learning
Poo Kuan Hoong
 
Explore and have fun with TensorFlow: An introductory to TensorFlow
Explore and have fun with TensorFlow: An introductory	to TensorFlowExplore and have fun with TensorFlow: An introductory	to TensorFlow
Explore and have fun with TensorFlow: An introductory to TensorFlow
Poo Kuan Hoong
 
The path to be a Data Scientist
The path to be a Data ScientistThe path to be a Data Scientist
The path to be a Data Scientist
Poo Kuan Hoong
 
Deep Learning with Microsoft R Open
Deep Learning with Microsoft R OpenDeep Learning with Microsoft R Open
Deep Learning with Microsoft R Open
Poo Kuan Hoong
 
Microsoft APAC Machine Learning & Data Science Community Bootcamp
Microsoft APAC Machine Learning & Data Science Community BootcampMicrosoft APAC Machine Learning & Data Science Community Bootcamp
Microsoft APAC Machine Learning & Data Science Community Bootcamp
Poo Kuan Hoong
 
Customer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R OpenCustomer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R Open
Poo Kuan Hoong
 
Machine Learning and Deep Learning with R
Machine Learning and Deep Learning with RMachine Learning and Deep Learning with R
Machine Learning and Deep Learning with R
Poo Kuan Hoong
 
The path to be a data scientist
The path to be a data scientistThe path to be a data scientist
The path to be a data scientist
Poo Kuan Hoong
 
MDEC Data Matters Series: machine learning and Deep Learning, A Primer
MDEC Data Matters Series: machine learning and Deep Learning, A PrimerMDEC Data Matters Series: machine learning and Deep Learning, A Primer
MDEC Data Matters Series: machine learning and Deep Learning, A Primer
Poo Kuan Hoong
 
Big Data Malaysia - A Primer on Deep Learning
Big Data Malaysia - A Primer on Deep LearningBig Data Malaysia - A Primer on Deep Learning
Big Data Malaysia - A Primer on Deep Learning
Poo Kuan Hoong
 
Handwritten Recognition using Deep Learning with R
Handwritten Recognition using Deep Learning with RHandwritten Recognition using Deep Learning with R
Handwritten Recognition using Deep Learning with R
Poo Kuan Hoong
 
An Introduction to Deep Learning
An Introduction to Deep LearningAn Introduction to Deep Learning
An Introduction to Deep Learning
Poo Kuan Hoong
 
Machine learning and big data
Machine learning and big dataMachine learning and big data
Machine learning and big data
Poo Kuan Hoong
 
DSRLab seminar Introduction to deep learning
DSRLab seminar   Introduction to deep learningDSRLab seminar   Introduction to deep learning
DSRLab seminar Introduction to deep learning
Poo Kuan Hoong
 
Context Aware Road Traffic Speech Information System from Social Media
Context Aware Road Traffic Speech Information System from Social MediaContext Aware Road Traffic Speech Information System from Social Media
Context Aware Road Traffic Speech Information System from Social Media
Poo Kuan Hoong
 
Ad

Recently uploaded (20)

Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 

TensorFlow and Keras: An Overview

  • 4. What is TensorFlow? • URL: https://www.tensorflow.org/ • Released under the open source license on November 9, 2015 • Current version 1.2 • Open source software library for numerical computation using data flow graphs • Originally developed by Google Brain Team to conduct machine learning and deep neural networks research • General enough to be applicable in a wide variety of other domains as well • TensorFlow provides an extensive suite of functions and classes that allow users to build various models from scratch.
  • 5. Most popular on Github https://github.com/tensorflow/tensorflow
  • 6. TensorFlow architecture • Core in C++ • Low overhead • Different front ends for specifying/driving the computation • Python, C++, R and many more
  • 7. CPU - GPU • In TensorFlow, the supported device types are CPU and GPU. They are represented as strings. For example: • "/cpu:0": The CPU of your machine. • "/gpu:0": The GPU of your machine, if you have one. • "/gpu:1": The second GPU of your machine, etc.
  • 8. What is a Tensor?
  • 9. Why it is called TensorFlow? ● TensorFlow is based on computation data flow graph ● TensorFlow separates definition of computations from their execution
  • 11. Learn Parameters: Optimization ● The Optimizer base class provides methods to compute gradients for a loss and apply gradients to variables. ● A collection of subclasses implement classic optimization algorithms such as GradientDescent and Adagrad. ● TensorFlow provides functions to compute the derivatives for a given TensorFlow computation graph, adding operations to the graph.
  • 13. TensorBoard • Visualize your TensorFlow graph • Plot quantitative metrics about the execution of your graph • Show additional data like images that pass through it
  • 14. TensorFlow Models https://github.com/tensorflow/models Models • adversarial_crypto: protecting communications with adversarial neural cryptography. • adversarial_text: semi-supervised sequence learning with adversarial training. • attention_ocr: a model for real-world image text extraction. • autoencoder: various autoencoders. • cognitive_mapping_and_planning: implementation of a spatial memory based mapping and planning architecture for visual navigation. • compression: compressing and decompressing images using a pre-trained Residual GRU network. • differential_privacy: privacy-preserving student models from multiple teachers. • domain_adaptation: domain separation networks. • im2txt: image-to-text neural network for image captioning. • inception: deep convolutional networks for computer vision.
  • 15. TensorFlow Serving •Flexible, high-performance serving system for machine learning models, designed for production environments. •Easy to deploy new algorithms and experiments, while keeping the same server architecture and APIs
  • 16. Code snippet import tensorflow as tf # build a linear model where y = w * x + b w = tf.Variable([0.2], tf.float32, name='weight') b = tf.Variable([0.3], tf.float32, name='bias') X = tf.placeholder(tf.float32, name="X") Y = tf.placeholder(tf.float32, name='Y') # the training values for x and y x = ([2.,3.,4.,5.]) y = ([-1.,-2.,-3.,-4.]) # define the linear model linear_model = w*X+b # define the loss function square_delta = tf.square(linear_model - Y) loss = tf.reduce_sum(square_delta) #set the learning rate and training epoch learning_rate = 0.01 training_epoch = 1000 # optimizer optimizer = tf.train.GradientDescentOptimizer(learning_rate) train = optimizer.minimize(loss) # start a session init = tf.global_variables_initializer() with tf.Session() as sess: sess.run(init) for i in range(training_epoch): sess.run(train, feed_dict={X:x,Y:y}) # evaluate training accuracy curr_w, curr_b, curr_loss = sess.run([w, b, loss], {X:x,Y:y}) print('w: %f b: %f loss: %f '%(curr_w, curr_b, curr_loss))
  • 17. TensorFlow: Installation • pip3 install tensorflow or • Anaconda: conda install -c conda-forge tensorflow
  • 19. Keras •https://keras.io/ •Minimalist, highly modular neural networks library •Written in Python •Capable of running on top of either TensorFlow/Theano and CNTK •Developed with a focus on enabling fast experimentation
  • 20. Guiding Principles •Modularity • A model is understood as a sequence or a graph of standalone, fully-configurable modules that can be plugged together with as little restrictions as possible •Minimalism • Each module should be kept short and simple •Easy extensibility • New modules can be easily added and extended •Python • Supports Python
  • 21. General Design •General idea is to based on layers and their input/output • Prepare your inputs and output tensors • Create first layer to handle input tensor • Create output layer to handle targets • Build virtually any model you like in between
  • 22. Layers •Keras has a number of pre-built layers. Notable examples include: • Regular dense, MLP type keras.layers.core.Dense(units, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None) • Recurrent layers, LTSM, GRU, etc keras.layers.recurrent.Recurrent(return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False, implementation=0)
  • 23. Layers • 1D Convolutional layers keras.layers.convolutional.Conv1D(filters, kernel_size, strides=1, padding='valid', dilation_rate=1, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None) • 2D Convolutional layers keras.layers.convolutional.Conv2D(filters, kernel_size, strides=(1, 1), padding='valid', data_format=None, dilation_rate=(1, 1), activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None)
  • 24. Why use Keras? •Easy and fast prototyping (through total modularity, minimalism, and extensibility). •Supports both convolutional networks and recurrent networks and combinations of the two. •Supports arbitrary connectivity schemes (including multi-input and multi-output training). •Runs seamlessly on CPU and GPU.
  • 25. Keras Code examples •The core data structure of Keras is a model •Model → a way to organize layers Model Sequential Graph
  • 26. Code-snippet import numpy as np from keras.models import Sequential from keras.layers.core import Activation, Dense from keras.optimizers import SGD X = np.array([[0,0],[0,1],[1,0],[1,1]]) y = np.array([[0],[1],[1],[0]]) model = Sequential() model.add(Dense(2, input_dim=2, activation='sigmoid')) model.add(Dense(1, activation='sigmoid')) sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True) model.compile(loss='mean_squared_error', optimizer=sgd) history = model.fit(X, y, nb_epoch=10000, batch_size=4)
  • 27. Keras: Installation • Theano : • pip3 install Theano • CNTK • $ export CNTK_BINARY_URL=... [choose link here] • pip3 install $CNTK_BINARY_URL • TensorFlow : • $ export TF_BINARY_URL=... [choose link here] • pip3 install $TF_BINARY_URL • Keras : • pip3 install keras • To enable GPU computing : • NVidia Cuda • CuDNN • CNMeM
  • 28. Demo Slides & Codes available from Github: https://github.com/kuanhoong/Magic_DeepLearning