SlideShare a Scribd company logo
1 of 66
#WTMIndia
#WTMIndia
Introduction to
Machine Learning
and Tensorflow
Lakshya Sivaramakrishnan
Program Coordinator, Women Techmakers
@lakshyas90
#WTMIndia
Human Learning
Features Labels
Colour Texture Taste Fruit
Red Smooth Sweet Apple
Orange Bumpy Sweet-Sour Orange
#WTMIndia
Machine Learning
The ability to learn without being explicitly
programmed.
or
Algorithm or model that learns patterns
in data and then predicts similar
patterns in new data.
or
Learning from experiences and examples.
Algorithm InsightData
#WTMIndia
When is the last
time you
experienced ML ?
#WTMIndia
It’s with us 24*7
(day in and day out)
#WTMIndia
Machine Learning
Artificial Intelligence
Neural Network
AI, ML, NN - Are all the same?
#WTMIndia
Why is ML important?
To solve interesting use cases
● Making speech recognition and machine translation
possible.
● The new search feature in Google Photos, which
received broad acclaim.
● Recognizing pedestrians and other vehicles in
self-driving cars
#WTMIndia
How Can You Get Started with ML?
Three ways, with varying complexity:
(1) Use a Cloud-based or Mobile API (Vision, Natural Language,
etc.)
(2) Use an existing model architecture, and retrain it or fine tune
on your dataset
(3) Develop your own machine learning models for new
problems
More
flexible,
but more
effort
required
#WTMIndia
Review:What/Why/How of ML
WHAT
Algorithms that can generate insights by learning from data.
WHY
Because algorithms can learn faster, cheaper, and better than
humans.
HOW
By finding patterns in data.
#WTMIndia
The Process
Algorithm
Model
New Data
Training
Predictions
Examples
#WTMIndia
Workflow
Apple
Orange
#WTMIndia
The processof ‘Learning’
SUPERVISED UNSUPERVISED REINFORCEMENT
Image Credits : https://goo.gl/xU5KCv, https://goo.gl/aDjjFR, https://goo.gl/3NGzuW
#WTMIndia
SupervisedLearning
SUPERVISED
● Teach the machine using data that’s well labelled
● Has prior knowledge of output
● Data is labelled with class or value
● Task driven
● Goal : predict class or value label
● Neural network, support vector machines , decision
trees etc
Image Credits : https://goo.gl/xU5KCv
#WTMIndia
UnsupervisedLearning
UNSUPERVISED
● Data set with no label
● Learning algo is not told what is being learnt
● No knowledge of output class of value
● Data driven
● Goal : determine patterns or grouping
● K-means, genetic algorithms, clustering
Image Credits : https://goo.gl/aDjjFR
#WTMIndia
Reinforcement Learning
REINFORCEMENT
● Similar to unsupervised learning
● Uses unlabelled data
● Outcome is evaluated and reward is fed back to
change the algo
● Algo learns to act in a given environment to achieve
a goal
● Goal driven
Image Credits : https://goo.gl/3NGzuW
#WTMIndia
Machine Learning use cases at Google
Search
Search ranking
Speech recognition
Android
Keyboard & speech input
Gmail
Smart reply
Spam classification
Drive
Intelligence in Apps
Chrome
Search by image
Assistant
Smart connections
across products
Maps
Parsing local search
Translate
Text, graphic and speech
translation
Cardboard
Smart stitching
Photos
Photos search
#WTMIndia
Smart reply
in Inbox by Gmail
10%
of all responses
sent on mobile
#WTMIndia
#WTMIndia
#WTMIndia
Neural Networks
● Interconnected web of nodes = neurons
● Receives a set of inputs, perform
calculations & use output to solve a
problem
● eg ) classification
● Multiple layer
● Use backpropagation to adjust the weights
Image Credits : https://goo.gl/H7mNnT
#WTMIndia
A multidimensional array.
A graph of operations.
#WTMIndia
● Fast, flexible, and scalable
open-source machine learning
library
● For research and production
● Runs on CPU, GPU, Android, iOS,
Raspberry Pi, Datacenters, Mobile
● Apache 2.0 license
https://research.googleblog.com/2016/11/celebrating-tensorflows-first-year.html
#WTMIndia
Sharing our tools with researchers and developers
around the world
repository
for “machine
learning”
category on
GitHub
Released in
Nov. 2015
#WTMIndia
What can we do with tensor flow?
#WTMIndia
Shared Research in TensorFlow
Inception https://research.googleblog.com/2016/08/improving-inception-and-image.html
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
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
#WTMIndia
BuildingModels
CONSTRUCTION PHASE
● Assembles the graph
● Define the computation graph
○ Input, Operations, Output
EXECUTION PHASE
● Executes operations in the graph
● Run Session
○ Execute graph and fetch output
Tensorflow programs are generally structured into two phases.
#WTMIndia
Build a graph; then run it.
...
c = tf.add(a, b)
...
session = tf.Session()
value_of_c = session.run(c, {a=1, b=2})
add
a b
c
TensorFlow separates computation graph construction from execution.
#WTMIndia
Let’s writesome code.
#WTMIndia
Code Demos
Hello World Matrix
Multiplication
Character
recognition
Fun experiments
#WTMIndia
Let’s dive deep into code - Hello World!
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print sess.run(hello)
Tell the compiler that you want to use all
functionalities that come with the
tensorflow package.
Create a constant op. This op is added as
a node to the default graph.
Start a session.
Run the operation and get the result.
Source : https://github.com/lakshya90/wwc-workshop/blob/master/hello_world.py
#WTMIndia
Let’s try Matrix Multiplication in TF
import tensorflow as tf
matrix1 = tf.constant([[3, 3]])
matrix2 = tf.constant([[2],[2]])
product = tf.matmul(matrix1, matrix2)
Tell the compiler that you want to use all functionalities
that come with the tensorflow package.
Create a constant op that produces a 1x2 matrix. The op is
added as a node to the default graph.The value returned by
the constructor represents the output of the Constant op.
Create another constant that produces a 2x1 matrix.
Create a matmul op that takes 'matrix1' and 'matrix2' as
inputs. The returned value, 'product', represents the result
of the matrix multiplication.
CONSTRUCTION PHASE
Source : https://github.com/lakshya90/wwc-workshop/blob/master/mat_mul.py
#WTMIndia
Trying Matrix Multiplication in TF
sess = tf.Session()
result = sess.run(product)
print(result)
sess.close()
Launch the default graph.
To run the matmul op we call the session 'run()' method,
passing 'product' which represents the output of the matmul op.
This indicates to the call that we want to get the output of the
matmul op back. All inputs needed by the op are run
automatically by the session. They typically are run in parallel.
The call 'run(product)' thus causes the execution of three ops in
the graph: the two constants and matmul.
The output of the op is returned in 'result' as a numpy `ndarray`
object. ==> [[ 12]]
Close the Session when we are done.
EXECUTION PHASE
Source : https://github.com/lakshya90/wwc-workshop/blob/master/mat_mul.py
#WTMIndia
What do we know so far ?
● Represents computations as graphs.
● Executes graphs in the context of Sessions.
● Represents data as tensors.
● Maintains state with Variables.
● Uses feeds and fetches to get data into and out of arbitrary operations.
Image from https://github.com/mnielsen/neural-networks-and-deep-learning
?
Hello Computer Vision World
#WTMIndia
What we see What the computer “sees”
#WTMIndia
Difficult without Machine Learning
def classify (pixels):
# handwritten rules ...
# ...
# ...
return 8
An image of a
handwritten digit
#WTMIndia
Machine Learning approach
Data
#WTMIndia
import tensorflow as tf
mnist = tf.contrib.learn.datasets.load_dataset('mnist')
Images
Labels 5 0 4 1 9 2
MNIST
#WTMIndia
Training data Testing data
training_data = mnist.train.images
training_labels = mnist.train.labels
testing_data = mnist.test.images
testing_labels = mnist.test.labels
#WTMIndia
Classifier
Training data Testing data
classifier = tf.learn.LinearClassifier(n_classes=10)
#WTMIndia
classifier = tf.learn.LinearClassifier(n_classes=10)
...
...
0 1 2 9
28x28
pixels
784 pixels
Connect each input
to each output
#WTMIndia
...
...
0 1 2 9
Weights
w1,0 w1,1 w1,2 w1,9
28x28
pixels
784 pixels
classifier = tf.learn.LinearClassifier(n_classes=10)
#WTMIndia
Fully connected
...
...
0 1 2 9
28x28
pixels
784 pixels
classifier = tf.learn.LinearClassifier(n_classes=10)
#WTMIndia
...
...
0 1 2 9
28x28
pixels
784 pixels
classifier = tf.learn.LinearClassifier(n_classes=10)
WeightInput
#WTMIndia
classifier.fit(mnist.train.images, mnist.train.labels)
...
...
0 1 2 9
28x28
pixels
784 pixels
#WTMIndia
Backpropagation
Error
Start
Gradient descent
#WTMIndia
Training data Testing data
Output: a prediction “1”
Input:
an image
#WTMIndia
Training data Testing data
Output: “8”
Input:
an image
#WTMIndia
score = metrics.accuracy_score(mnist.test.labels,
classifier.predict(mnist.test.images))
...
...
0 1 2 9
28x28
pixels
784 pixels actual label
predicted label
#WTMIndia
score = metrics.accuracy_score(mnist.test.labels,
classifier.predict(mnist.test.images))
...
...
0 1 2 9
92% accuracy
Is this good?
28x28
pixels
784 pixels
#WTMIndia
#WTMIndia
Using TensorFlow on MNIST
import numpy as np
import tensorflow as tf
import tf.contrib.learn as learn
mnist = learn.datasets.load_dataset('mnist')
data = mnist.train.images
labels = np.asarray(mnist.train.labels, dtype=np.int32)
test_data = mnist.test.images
test_labels = np.asarray(mnist.test.labels, dtype=np.int32)
feature_columns = learn.infer_real_valued_columns_from_input(data)
classifier = learn.LinearClassifier(feature_columns=feature_columns, n_classes=10)
classifier.fit(data, labels, batch_size=100, steps=1000)
classifier.evaluate(test_data, test_labels)
print classifier.evaluate(test_data, test_labels)["accuracy"]
Import required libraries
Import the dataset
Fit a linear classifier
Evaluate accuracy
Source : https://github.com/lakshya90/wwc-workshop/blob/master/mnist.py
...
...
0 1 2 9
{Hidden
layers
#WTMIndia
import tensorflow as tf
mnist = tf.contrib.learn.datasets.load_dataset('mnist')
classifier = tf.learn.DNNClassifier(n_classes=10, 
hidden_units[1024,512,256)
classifier.fit(mnist.train.images, mnist.train.labels)
score = metrics.accuracy_score(mnist.test.labels, 
classifier.predict(mnist.test.images))
print('Accuracy: {0:f}'.format(score))
#WTMIndia
#WTMIndia
Using TensorFlow on MNIST
import numpy as np
import tensorflow as tf
import tf.contrib.learn as learn
mnist = learn.datasets.load_dataset('mnist')
data = mnist.train.images
labels = np.asarray(mnist.train.labels, dtype=np.int32)
test_data = mnist.test.images
test_labels = np.asarray(mnist.test.labels, dtype=np.int32)
feature_columns = learn.infer_real_valued_columns_from_input(data)
classifier = learn.DNNClassifier(feature_columns=feature_columns, n_classes=10,
hidden_units = [1024,512,256])
classifier.fit(data, labels, batch_size=100, steps=1000)
classifier.evaluate(test_data, test_labels)
print classifier.evaluate(test_data, test_labels)["accuracy"]
Import required libraries
Import the dataset
Fit a linear classifier
Evaluate accuracy
Source : https://github.com/lakshya90/wwc-workshop/blob/master/mnist_DNN.py
#WTMIndia
Fun experiments
+ = ?
#WTMIndia
Fun experiments
+ =
#WTMIndia
What Does A.I. Have To Do With This Selfie?
#WTMIndia
● Step 1 : Get the content and style image.
● Step 2 : Import the neural_style.py, stylize.py and vgg.py file. Ensure the mat file is
present in your top level directory.
○ https://github.com/lakshya90/wwc-workshop, https://goo.gl/2hck1z
● Step 3 : Get your style transferred image.
○ python neural_style.py --content <content-file> --styles <style-file> --output <output-file>
Try them out - goo.gl/fyDxhC
#WTMIndia
Source : https://github.com/lakshya90/wwc-workshop/tree/master/style_transfer
#WTMIndia
Challenge
Push your code to GITHUB
https://guides.github.com/activities/hello-world/
http://rogerdudler.github.io/git-guide/
RESOURCES :
https://github.com/lakshya90/wwc-workshop
Lots of tutorials at tensorflow.org
#WTMIndia
Codelab - goo.gl/xGsB9d Video - goo.gl/B2zYWN
TensorFlow for Poets
#WTMIndia
tensorflow.org
github.com/tensorflow
Want to learn more?
Udacity class on Deep Learning, goo.gl/iHssII
Guides, codelabs, videos
MNIST for Beginners, goo.gl/tx8R2b
TF Learn Quickstart, goo.gl/uiefRn
TensorFlow for Poets, goo.gl/bVjFIL
ML Recipes, goo.gl/KewA03
TensorFlow and Deep Learning without a PhD, goo.gl/pHeXe7
Next steps
#WTMIndia
#WTMIndia
Thank You!
Lakshya Sivaramakrishnan
@lakshyas90

More Related Content

What's hot

Beyond Churn Prediction : An Introduction to uplift modeling
Beyond Churn Prediction : An Introduction to uplift modelingBeyond Churn Prediction : An Introduction to uplift modeling
Beyond Churn Prediction : An Introduction to uplift modelingPierre Gutierrez
 
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...Edureka!
 
Privacy preserving machine learning
Privacy preserving machine learningPrivacy preserving machine learning
Privacy preserving machine learningMichał Kuźba
 
Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work IIMohamed Loey
 
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...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
 
Spectral clustering
Spectral clusteringSpectral clustering
Spectral clusteringSOYEON KIM
 
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning akira-ai
 
Graph Neural Network - Introduction
Graph Neural Network - IntroductionGraph Neural Network - Introduction
Graph Neural Network - IntroductionJungwon Kim
 
An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)Thomas da Silva Paula
 
Using MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsUsing MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsWeaveworks
 
Applications in Machine Learning
Applications in Machine LearningApplications in Machine Learning
Applications in Machine LearningJoel Graff
 
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdf
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdfMachine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdf
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdfMaris R
 
Unified Approach to Interpret Machine Learning Model: SHAP + LIME
Unified Approach to Interpret Machine Learning Model: SHAP + LIMEUnified Approach to Interpret Machine Learning Model: SHAP + LIME
Unified Approach to Interpret Machine Learning Model: SHAP + LIMEDatabricks
 
Tensorflow presentation
Tensorflow presentationTensorflow presentation
Tensorflow presentationAhmed rebai
 
Automated Machine Learning
Automated Machine LearningAutomated Machine Learning
Automated Machine LearningYuriy Guts
 
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | Edureka
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | EdurekaKeras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | Edureka
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | EdurekaEdureka!
 
Explainable AI in Industry (FAT* 2020 Tutorial)
Explainable AI in Industry (FAT* 2020 Tutorial)Explainable AI in Industry (FAT* 2020 Tutorial)
Explainable AI in Industry (FAT* 2020 Tutorial)Krishnaram Kenthapadi
 
How to choose Machine Learning algorithm.
How to choose Machine Learning  algorithm.How to choose Machine Learning  algorithm.
How to choose Machine Learning algorithm.Mala Deep Upadhaya
 

What's hot (20)

Beyond Churn Prediction : An Introduction to uplift modeling
Beyond Churn Prediction : An Introduction to uplift modelingBeyond Churn Prediction : An Introduction to uplift modeling
Beyond Churn Prediction : An Introduction to uplift modeling
 
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
 
Privacy preserving machine learning
Privacy preserving machine learningPrivacy preserving machine learning
Privacy preserving machine learning
 
ML Basics
ML BasicsML Basics
ML Basics
 
Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work II
 
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...
AI vs Machine Learning vs Deep Learning | Machine Learning Training with Pyth...
 
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...
 
Spectral clustering
Spectral clusteringSpectral clustering
Spectral clustering
 
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
PPT4: Frameworks & Libraries of Machine Learning & Deep Learning
 
Graph Neural Network - Introduction
Graph Neural Network - IntroductionGraph Neural Network - Introduction
Graph Neural Network - Introduction
 
An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)
 
Using MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsUsing MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOps
 
Applications in Machine Learning
Applications in Machine LearningApplications in Machine Learning
Applications in Machine Learning
 
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdf
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdfMachine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdf
Machine-Learning-A-Z-Course-Downloadable-Slides-V1.5.pdf
 
Unified Approach to Interpret Machine Learning Model: SHAP + LIME
Unified Approach to Interpret Machine Learning Model: SHAP + LIMEUnified Approach to Interpret Machine Learning Model: SHAP + LIME
Unified Approach to Interpret Machine Learning Model: SHAP + LIME
 
Tensorflow presentation
Tensorflow presentationTensorflow presentation
Tensorflow presentation
 
Automated Machine Learning
Automated Machine LearningAutomated Machine Learning
Automated Machine Learning
 
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | Edureka
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | EdurekaKeras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | Edureka
Keras vs Tensorflow vs PyTorch | Deep Learning Frameworks Comparison | Edureka
 
Explainable AI in Industry (FAT* 2020 Tutorial)
Explainable AI in Industry (FAT* 2020 Tutorial)Explainable AI in Industry (FAT* 2020 Tutorial)
Explainable AI in Industry (FAT* 2020 Tutorial)
 
How to choose Machine Learning algorithm.
How to choose Machine Learning  algorithm.How to choose Machine Learning  algorithm.
How to choose Machine Learning algorithm.
 

Similar to Machine learning workshop

Google Big Data Expo
Google Big Data ExpoGoogle Big Data Expo
Google Big Data ExpoBigDataExpo
 
Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Isabel Palomar
 
Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Isabel Palomar
 
Building a custom machine learning model on android
Building a custom machine learning model on androidBuilding a custom machine learning model on android
Building a custom machine learning model on androidIsabel Palomar
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereIsabel Palomar
 
Leverage the power of machine learning on windows
Leverage the power of machine learning on windowsLeverage the power of machine learning on windows
Leverage the power of machine learning on windowsMia Chang
 
Inteligencia artificial para android como empezar
Inteligencia artificial para android como empezarInteligencia artificial para android como empezar
Inteligencia artificial para android como empezarIsabel Palomar
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle Databricks
 
2017 arab wic marwa ayad machine learning
2017 arab wic marwa ayad machine learning2017 arab wic marwa ayad machine learning
2017 arab wic marwa ayad machine learningmarwa Ayad Mohamed
 
Leverage the power of machine learning on windows
Leverage the power of machine learning on windowsLeverage the power of machine learning on windows
Leverage the power of machine learning on windowsJosé António Silva
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learningwesley chun
 
Deep Learning Jump Start
Deep Learning Jump StartDeep Learning Jump Start
Deep Learning Jump StartMichele Toni
 
Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016MLconf
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)wesley chun
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixJustin Basilico
 
Flyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoFlyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoKetanUmare
 
"Deployment for free": removing the need to write model deployment code at St...
"Deployment for free": removing the need to write model deployment code at St..."Deployment for free": removing the need to write model deployment code at St...
"Deployment for free": removing the need to write model deployment code at St...Stefan Krawczyk
 

Similar to Machine learning workshop (20)

Google Big Data Expo
Google Big Data ExpoGoogle Big Data Expo
Google Big Data Expo
 
Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...
 
Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019
 
Building a custom machine learning model on android
Building a custom machine learning model on androidBuilding a custom machine learning model on android
Building a custom machine learning model on android
 
ML in Android
ML in AndroidML in Android
ML in Android
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/Everywhere
 
Leverage the power of machine learning on windows
Leverage the power of machine learning on windowsLeverage the power of machine learning on windows
Leverage the power of machine learning on windows
 
Inteligencia artificial para android como empezar
Inteligencia artificial para android como empezarInteligencia artificial para android como empezar
Inteligencia artificial para android como empezar
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle
 
2017 arab wic marwa ayad machine learning
2017 arab wic marwa ayad machine learning2017 arab wic marwa ayad machine learning
2017 arab wic marwa ayad machine learning
 
Leverage the power of machine learning on windows
Leverage the power of machine learning on windowsLeverage the power of machine learning on windows
Leverage the power of machine learning on windows
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 
Persian MNIST in 5 Minutes
Persian MNIST in 5 MinutesPersian MNIST in 5 Minutes
Persian MNIST in 5 Minutes
 
Deep Learning Jump Start
Deep Learning Jump StartDeep Learning Jump Start
Deep Learning Jump Start
 
Introduction to ML.NET
Introduction to ML.NETIntroduction to ML.NET
Introduction to ML.NET
 
Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016Kaz Sato, Evangelist, Google at MLconf ATL 2016
Kaz Sato, Evangelist, Google at MLconf ATL 2016
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at Netflix
 
Flyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoFlyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiego
 
"Deployment for free": removing the need to write model deployment code at St...
"Deployment for free": removing the need to write model deployment code at St..."Deployment for free": removing the need to write model deployment code at St...
"Deployment for free": removing the need to write model deployment code at St...
 

Recently uploaded

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Machine learning workshop

  • 1. #WTMIndia #WTMIndia Introduction to Machine Learning and Tensorflow Lakshya Sivaramakrishnan Program Coordinator, Women Techmakers @lakshyas90
  • 2. #WTMIndia Human Learning Features Labels Colour Texture Taste Fruit Red Smooth Sweet Apple Orange Bumpy Sweet-Sour Orange
  • 3. #WTMIndia Machine Learning The ability to learn without being explicitly programmed. or Algorithm or model that learns patterns in data and then predicts similar patterns in new data. or Learning from experiences and examples. Algorithm InsightData
  • 4. #WTMIndia When is the last time you experienced ML ?
  • 5. #WTMIndia It’s with us 24*7 (day in and day out)
  • 6. #WTMIndia Machine Learning Artificial Intelligence Neural Network AI, ML, NN - Are all the same?
  • 7. #WTMIndia Why is ML important? To solve interesting use cases ● Making speech recognition and machine translation possible. ● The new search feature in Google Photos, which received broad acclaim. ● Recognizing pedestrians and other vehicles in self-driving cars
  • 8. #WTMIndia How Can You Get Started with ML? Three ways, with varying complexity: (1) Use a Cloud-based or Mobile API (Vision, Natural Language, etc.) (2) Use an existing model architecture, and retrain it or fine tune on your dataset (3) Develop your own machine learning models for new problems More flexible, but more effort required
  • 9. #WTMIndia Review:What/Why/How of ML WHAT Algorithms that can generate insights by learning from data. WHY Because algorithms can learn faster, cheaper, and better than humans. HOW By finding patterns in data.
  • 12. #WTMIndia The processof ‘Learning’ SUPERVISED UNSUPERVISED REINFORCEMENT Image Credits : https://goo.gl/xU5KCv, https://goo.gl/aDjjFR, https://goo.gl/3NGzuW
  • 13. #WTMIndia SupervisedLearning SUPERVISED ● Teach the machine using data that’s well labelled ● Has prior knowledge of output ● Data is labelled with class or value ● Task driven ● Goal : predict class or value label ● Neural network, support vector machines , decision trees etc Image Credits : https://goo.gl/xU5KCv
  • 14. #WTMIndia UnsupervisedLearning UNSUPERVISED ● Data set with no label ● Learning algo is not told what is being learnt ● No knowledge of output class of value ● Data driven ● Goal : determine patterns or grouping ● K-means, genetic algorithms, clustering Image Credits : https://goo.gl/aDjjFR
  • 15. #WTMIndia Reinforcement Learning REINFORCEMENT ● Similar to unsupervised learning ● Uses unlabelled data ● Outcome is evaluated and reward is fed back to change the algo ● Algo learns to act in a given environment to achieve a goal ● Goal driven Image Credits : https://goo.gl/3NGzuW
  • 16. #WTMIndia Machine Learning use cases at Google Search Search ranking Speech recognition Android Keyboard & speech input Gmail Smart reply Spam classification Drive Intelligence in Apps Chrome Search by image Assistant Smart connections across products Maps Parsing local search Translate Text, graphic and speech translation Cardboard Smart stitching Photos Photos search
  • 17. #WTMIndia Smart reply in Inbox by Gmail 10% of all responses sent on mobile
  • 20. #WTMIndia Neural Networks ● Interconnected web of nodes = neurons ● Receives a set of inputs, perform calculations & use output to solve a problem ● eg ) classification ● Multiple layer ● Use backpropagation to adjust the weights Image Credits : https://goo.gl/H7mNnT
  • 21.
  • 23. #WTMIndia ● Fast, flexible, and scalable open-source machine learning library ● For research and production ● Runs on CPU, GPU, Android, iOS, Raspberry Pi, Datacenters, Mobile ● Apache 2.0 license https://research.googleblog.com/2016/11/celebrating-tensorflows-first-year.html
  • 24. #WTMIndia Sharing our tools with researchers and developers around the world repository for “machine learning” category on GitHub Released in Nov. 2015
  • 25. #WTMIndia What can we do with tensor flow?
  • 26.
  • 27. #WTMIndia Shared Research in TensorFlow Inception https://research.googleblog.com/2016/08/improving-inception-and-image.html 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 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
  • 28. #WTMIndia BuildingModels CONSTRUCTION PHASE ● Assembles the graph ● Define the computation graph ○ Input, Operations, Output EXECUTION PHASE ● Executes operations in the graph ● Run Session ○ Execute graph and fetch output Tensorflow programs are generally structured into two phases.
  • 29. #WTMIndia Build a graph; then run it. ... c = tf.add(a, b) ... session = tf.Session() value_of_c = session.run(c, {a=1, b=2}) add a b c TensorFlow separates computation graph construction from execution.
  • 31. #WTMIndia Code Demos Hello World Matrix Multiplication Character recognition Fun experiments
  • 32. #WTMIndia Let’s dive deep into code - Hello World! import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print sess.run(hello) Tell the compiler that you want to use all functionalities that come with the tensorflow package. Create a constant op. This op is added as a node to the default graph. Start a session. Run the operation and get the result. Source : https://github.com/lakshya90/wwc-workshop/blob/master/hello_world.py
  • 33. #WTMIndia Let’s try Matrix Multiplication in TF import tensorflow as tf matrix1 = tf.constant([[3, 3]]) matrix2 = tf.constant([[2],[2]]) product = tf.matmul(matrix1, matrix2) Tell the compiler that you want to use all functionalities that come with the tensorflow package. Create a constant op that produces a 1x2 matrix. The op is added as a node to the default graph.The value returned by the constructor represents the output of the Constant op. Create another constant that produces a 2x1 matrix. Create a matmul op that takes 'matrix1' and 'matrix2' as inputs. The returned value, 'product', represents the result of the matrix multiplication. CONSTRUCTION PHASE Source : https://github.com/lakshya90/wwc-workshop/blob/master/mat_mul.py
  • 34. #WTMIndia Trying Matrix Multiplication in TF sess = tf.Session() result = sess.run(product) print(result) sess.close() Launch the default graph. To run the matmul op we call the session 'run()' method, passing 'product' which represents the output of the matmul op. This indicates to the call that we want to get the output of the matmul op back. All inputs needed by the op are run automatically by the session. They typically are run in parallel. The call 'run(product)' thus causes the execution of three ops in the graph: the two constants and matmul. The output of the op is returned in 'result' as a numpy `ndarray` object. ==> [[ 12]] Close the Session when we are done. EXECUTION PHASE Source : https://github.com/lakshya90/wwc-workshop/blob/master/mat_mul.py
  • 35. #WTMIndia What do we know so far ? ● Represents computations as graphs. ● Executes graphs in the context of Sessions. ● Represents data as tensors. ● Maintains state with Variables. ● Uses feeds and fetches to get data into and out of arbitrary operations.
  • 37. What we see What the computer “sees” #WTMIndia
  • 38. Difficult without Machine Learning def classify (pixels): # handwritten rules ... # ... # ... return 8 An image of a handwritten digit #WTMIndia
  • 40. import tensorflow as tf mnist = tf.contrib.learn.datasets.load_dataset('mnist') Images Labels 5 0 4 1 9 2 MNIST #WTMIndia
  • 41. Training data Testing data training_data = mnist.train.images training_labels = mnist.train.labels testing_data = mnist.test.images testing_labels = mnist.test.labels #WTMIndia
  • 42. Classifier Training data Testing data classifier = tf.learn.LinearClassifier(n_classes=10) #WTMIndia
  • 43. classifier = tf.learn.LinearClassifier(n_classes=10) ... ... 0 1 2 9 28x28 pixels 784 pixels Connect each input to each output #WTMIndia
  • 44. ... ... 0 1 2 9 Weights w1,0 w1,1 w1,2 w1,9 28x28 pixels 784 pixels classifier = tf.learn.LinearClassifier(n_classes=10) #WTMIndia
  • 45. Fully connected ... ... 0 1 2 9 28x28 pixels 784 pixels classifier = tf.learn.LinearClassifier(n_classes=10) #WTMIndia
  • 46. ... ... 0 1 2 9 28x28 pixels 784 pixels classifier = tf.learn.LinearClassifier(n_classes=10) WeightInput #WTMIndia
  • 49. Training data Testing data Output: a prediction “1” Input: an image #WTMIndia
  • 50. Training data Testing data Output: “8” Input: an image #WTMIndia
  • 51. score = metrics.accuracy_score(mnist.test.labels, classifier.predict(mnist.test.images)) ... ... 0 1 2 9 28x28 pixels 784 pixels actual label predicted label #WTMIndia
  • 52. score = metrics.accuracy_score(mnist.test.labels, classifier.predict(mnist.test.images)) ... ... 0 1 2 9 92% accuracy Is this good? 28x28 pixels 784 pixels #WTMIndia
  • 53. #WTMIndia Using TensorFlow on MNIST import numpy as np import tensorflow as tf import tf.contrib.learn as learn mnist = learn.datasets.load_dataset('mnist') data = mnist.train.images labels = np.asarray(mnist.train.labels, dtype=np.int32) test_data = mnist.test.images test_labels = np.asarray(mnist.test.labels, dtype=np.int32) feature_columns = learn.infer_real_valued_columns_from_input(data) classifier = learn.LinearClassifier(feature_columns=feature_columns, n_classes=10) classifier.fit(data, labels, batch_size=100, steps=1000) classifier.evaluate(test_data, test_labels) print classifier.evaluate(test_data, test_labels)["accuracy"] Import required libraries Import the dataset Fit a linear classifier Evaluate accuracy Source : https://github.com/lakshya90/wwc-workshop/blob/master/mnist.py
  • 54. ... ... 0 1 2 9 {Hidden layers #WTMIndia
  • 55. import tensorflow as tf mnist = tf.contrib.learn.datasets.load_dataset('mnist') classifier = tf.learn.DNNClassifier(n_classes=10, hidden_units[1024,512,256) classifier.fit(mnist.train.images, mnist.train.labels) score = metrics.accuracy_score(mnist.test.labels, classifier.predict(mnist.test.images)) print('Accuracy: {0:f}'.format(score)) #WTMIndia
  • 56. #WTMIndia Using TensorFlow on MNIST import numpy as np import tensorflow as tf import tf.contrib.learn as learn mnist = learn.datasets.load_dataset('mnist') data = mnist.train.images labels = np.asarray(mnist.train.labels, dtype=np.int32) test_data = mnist.test.images test_labels = np.asarray(mnist.test.labels, dtype=np.int32) feature_columns = learn.infer_real_valued_columns_from_input(data) classifier = learn.DNNClassifier(feature_columns=feature_columns, n_classes=10, hidden_units = [1024,512,256]) classifier.fit(data, labels, batch_size=100, steps=1000) classifier.evaluate(test_data, test_labels) print classifier.evaluate(test_data, test_labels)["accuracy"] Import required libraries Import the dataset Fit a linear classifier Evaluate accuracy Source : https://github.com/lakshya90/wwc-workshop/blob/master/mnist_DNN.py
  • 59.
  • 60. #WTMIndia What Does A.I. Have To Do With This Selfie? #WTMIndia
  • 61. ● Step 1 : Get the content and style image. ● Step 2 : Import the neural_style.py, stylize.py and vgg.py file. Ensure the mat file is present in your top level directory. ○ https://github.com/lakshya90/wwc-workshop, https://goo.gl/2hck1z ● Step 3 : Get your style transferred image. ○ python neural_style.py --content <content-file> --styles <style-file> --output <output-file> Try them out - goo.gl/fyDxhC #WTMIndia Source : https://github.com/lakshya90/wwc-workshop/tree/master/style_transfer
  • 62. #WTMIndia Challenge Push your code to GITHUB https://guides.github.com/activities/hello-world/ http://rogerdudler.github.io/git-guide/ RESOURCES : https://github.com/lakshya90/wwc-workshop
  • 63. Lots of tutorials at tensorflow.org #WTMIndia
  • 64. Codelab - goo.gl/xGsB9d Video - goo.gl/B2zYWN TensorFlow for Poets #WTMIndia
  • 65. tensorflow.org github.com/tensorflow Want to learn more? Udacity class on Deep Learning, goo.gl/iHssII Guides, codelabs, videos MNIST for Beginners, goo.gl/tx8R2b TF Learn Quickstart, goo.gl/uiefRn TensorFlow for Poets, goo.gl/bVjFIL ML Recipes, goo.gl/KewA03 TensorFlow and Deep Learning without a PhD, goo.gl/pHeXe7 Next steps #WTMIndia