Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
#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
Machine learning workshop
#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?
Machine learning workshop
#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
+ =
Machine learning workshop
#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

MachineLearning.ppt
MachineLearning.pptMachineLearning.ppt
MachineLearning.ppt
butest
 
Machine learning
Machine learning Machine learning
Machine learning
Saurabh Agrawal
 
Artificial Intelligence with Python | Edureka
Artificial Intelligence with Python | EdurekaArtificial Intelligence with Python | Edureka
Artificial Intelligence with Python | Edureka
Edureka!
 
Foundations of Machine Learning
Foundations of Machine LearningFoundations of Machine Learning
Foundations of Machine Learning
mahutte
 
Machine learning
Machine learningMachine learning
Machine learning
Rajib Kumar De
 
Introduction to Deep Learning
Introduction to Deep LearningIntroduction to Deep Learning
Introduction to Deep Learning
Oswald Campesato
 
Introduction to Transformer Model
Introduction to Transformer ModelIntroduction to Transformer Model
Introduction to Transformer Model
Nuwan Sriyantha Bandara
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
Sajid Marwat
 
Intro to deep learning
Intro to deep learning Intro to deep learning
Intro to deep learning
David Voyles
 
Supervised learning
  Supervised learning  Supervised learning
Supervised learning
Learnbay Datascience
 
Machine Learning presentation.
Machine Learning presentation.Machine Learning presentation.
Machine Learning presentation.
butest
 
Introduction to AI & ML
Introduction to AI & MLIntroduction to AI & ML
Introduction to AI & ML
Mandy Sidana
 
Explainable AI
Explainable AIExplainable AI
Explainable AI
Arithmer Inc.
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processing
Pranav Gupta
 
Types of Machine Learning
Types of Machine LearningTypes of Machine Learning
Types of Machine Learning
Samra Shahzadi
 
introduction to machin learning
introduction to machin learningintroduction to machin learning
introduction to machin learning
nilimapatel6
 
1. Introduction to deep learning.pptx
1. Introduction to deep learning.pptx1. Introduction to deep learning.pptx
1. Introduction to deep learning.pptx
Omer Tariq
 
Deep learning
Deep learningDeep learning
Deep learning
Ratnakar Pandey
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning Presentation
Ankit Gupta
 
Machine learning
Machine learningMachine learning
Machine learning
Rohit Kumar
 

What's hot (20)

MachineLearning.ppt
MachineLearning.pptMachineLearning.ppt
MachineLearning.ppt
 
Machine learning
Machine learning Machine learning
Machine learning
 
Artificial Intelligence with Python | Edureka
Artificial Intelligence with Python | EdurekaArtificial Intelligence with Python | Edureka
Artificial Intelligence with Python | Edureka
 
Foundations of Machine Learning
Foundations of Machine LearningFoundations of Machine Learning
Foundations of Machine Learning
 
Machine learning
Machine learningMachine learning
Machine learning
 
Introduction to Deep Learning
Introduction to Deep LearningIntroduction to Deep Learning
Introduction to Deep Learning
 
Introduction to Transformer Model
Introduction to Transformer ModelIntroduction to Transformer Model
Introduction to Transformer Model
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 
Intro to deep learning
Intro to deep learning Intro to deep learning
Intro to deep learning
 
Supervised learning
  Supervised learning  Supervised learning
Supervised learning
 
Machine Learning presentation.
Machine Learning presentation.Machine Learning presentation.
Machine Learning presentation.
 
Introduction to AI & ML
Introduction to AI & MLIntroduction to AI & ML
Introduction to AI & ML
 
Explainable AI
Explainable AIExplainable AI
Explainable AI
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processing
 
Types of Machine Learning
Types of Machine LearningTypes of Machine Learning
Types of Machine Learning
 
introduction to machin learning
introduction to machin learningintroduction to machin learning
introduction to machin learning
 
1. Introduction to deep learning.pptx
1. Introduction to deep learning.pptx1. Introduction to deep learning.pptx
1. Introduction to deep learning.pptx
 
Deep learning
Deep learningDeep learning
Deep learning
 
Intro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning PresentationIntro/Overview on Machine Learning Presentation
Intro/Overview on Machine Learning Presentation
 
Machine learning
Machine learningMachine learning
Machine learning
 

Similar to Machine learning workshop

Google Big Data Expo
Google Big Data ExpoGoogle Big Data Expo
Google Big Data Expo
BigDataExpo
 
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 2019
Isabel 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 android
Isabel Palomar
 
ML in Android
ML in AndroidML in Android
ML in Android
Jose Antonio Corbacho
 
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
Isabel 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 windows
Mia Chang
 
Inteligencia artificial para android como empezar
Inteligencia artificial para android como empezarInteligencia artificial para android como empezar
Inteligencia artificial para android como empezar
Isabel 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 learning
marwa 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 windows
José António Silva
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
wesley chun
 
Persian MNIST in 5 Minutes
Persian MNIST in 5 MinutesPersian MNIST in 5 Minutes
Persian MNIST in 5 Minutes
Shahriar Yazdipour
 
Deep Learning Jump Start
Deep Learning Jump StartDeep Learning Jump Start
Deep Learning Jump Start
Michele Toni
 
Introduction to ML.NET
Introduction to ML.NETIntroduction to ML.NET
Introduction to ML.NET
Gianni Rosa Gallina
 
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
MLconf
 
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 Netflix
Justin Basilico
 
Flyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiegoFlyte kubecon 2019 SanDiego
Flyte kubecon 2019 SanDiego
KetanUmare
 
"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

Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinhBài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
NguynThNhQunh59
 
UiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentationsUiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentations
UiPathCommunity
 
Scientific-Based Blockchain TON Project Analysis Report
Scientific-Based Blockchain  TON Project Analysis ReportScientific-Based Blockchain  TON Project Analysis Report
Scientific-Based Blockchain TON Project Analysis Report
SelcukTOPAL2
 
Indian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for StartupsIndian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for Startups
AMol NAik
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Alliance
 
Mega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in MarketoMega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in Marketo
Stephanie Tyagita
 
The Challenge of Interpretability in Generative AI Models.pdf
The Challenge of Interpretability in Generative AI Models.pdfThe Challenge of Interpretability in Generative AI Models.pdf
The Challenge of Interpretability in Generative AI Models.pdf
Sara Kroft
 
FIDO Munich Seminar Workforce Authentication Case Study.pptx
FIDO Munich Seminar Workforce Authentication Case Study.pptxFIDO Munich Seminar Workforce Authentication Case Study.pptx
FIDO Munich Seminar Workforce Authentication Case Study.pptx
FIDO Alliance
 
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptxFIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Alliance
 
Project management Course in Australia.pptx
Project management Course in Australia.pptxProject management Course in Australia.pptx
Project management Course in Australia.pptx
deathreaper9
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
Nohoax Kanont
 
Jacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and UsesJacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and Uses
ldtexsolbl
 
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Cori Faklaris
 
Top keywords searches on home and garden
Top keywords searches on home and gardenTop keywords searches on home and garden
Top keywords searches on home and garden
riannecreativetwo
 
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, ConnectUiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPathCommunity
 
TribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeftTribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeft
Dimpy Adhikary
 
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptxFIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
FIDO Alliance
 
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdfDefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
Yury Chemerkin
 
Top keywords searches on business in AUS
Top keywords searches on business in AUSTop keywords searches on business in AUS
Top keywords searches on business in AUS
riannecreativetwo
 
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VRIVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
Mark Billinghurst
 

Recently uploaded (20)

Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinhBài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
Bài tập tiếng anh lớp 9 - Ôn tập tuyển sinh
 
UiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentationsUiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentations
 
Scientific-Based Blockchain TON Project Analysis Report
Scientific-Based Blockchain  TON Project Analysis ReportScientific-Based Blockchain  TON Project Analysis Report
Scientific-Based Blockchain TON Project Analysis Report
 
Indian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for StartupsIndian Privacy law & Infosec for Startups
Indian Privacy law & Infosec for Startups
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
 
Mega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in MarketoMega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in Marketo
 
The Challenge of Interpretability in Generative AI Models.pdf
The Challenge of Interpretability in Generative AI Models.pdfThe Challenge of Interpretability in Generative AI Models.pdf
The Challenge of Interpretability in Generative AI Models.pdf
 
FIDO Munich Seminar Workforce Authentication Case Study.pptx
FIDO Munich Seminar Workforce Authentication Case Study.pptxFIDO Munich Seminar Workforce Authentication Case Study.pptx
FIDO Munich Seminar Workforce Authentication Case Study.pptx
 
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptxFIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
 
Project management Course in Australia.pptx
Project management Course in Australia.pptxProject management Course in Australia.pptx
Project management Course in Australia.pptx
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
 
Jacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and UsesJacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and Uses
 
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...
 
Top keywords searches on home and garden
Top keywords searches on home and gardenTop keywords searches on home and garden
Top keywords searches on home and garden
 
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, ConnectUiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, Connect
 
TribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeftTribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeft
 
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptxFIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
FIDO Munich Seminar: Strong Workforce Authn Push & Pull Factors.pptx
 
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdfDefCamp_2016_Chemerkin_Yury_--_publish.pdf
DefCamp_2016_Chemerkin_Yury_--_publish.pdf
 
Top keywords searches on business in AUS
Top keywords searches on business in AUSTop keywords searches on business in AUS
Top keywords searches on business in AUS
 
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VRIVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
 

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
  • 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?
  • 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
  • 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