SlideShare a Scribd company logo
1 of 35
Download to read offline
Machine Learning at
scale with GCP
using ML Engine & Python Dataflow
19/09/2017
Matthias Feys
2
About ML6/Datatonic
We are a team of data scientists, machine learning
experts, software engineers and mathematicians.
Our mission is to provide tailor-made systems to help
your organization get smart actionable insights from
large data volumes.
+ Specialized Machine Learning partner of Google
Cloud
Matthias Feys
GDE for ML and GCP
@FsMatt - matthiasfeys@gmail.com
3 Outline
Dissecting a Machine Learning Project
Mapping the components to GCP tools
Building a boilerplate example
1
2
3
4
Opinionated view
Focus on tooling
not complete overview
no focus on models
no focus business
Caveats
5 Outline
Dissecting a Machine Learning Project
Mapping the components to GCP tools
Building a boilerplate example
1
2
3
6 Popular image of what ML is
Lots of data Magical resultsComplex mathematics in multidimensional spaces
7 In reality, ML is
Collect
data
Create
model
Train model with
organized data
Organize
data
Deploy trained
model
iterate
8 Concrete use case: predict stellar masses*
*data and problem of the 1st
DSGhent hackathon: https://astrohack.org
Predict stellar mass based
on:
● image of galaxy
● distance to galaxy
9 Collect & organize data
Input:
76k labelled galaxies:
● 1 grayscale image in different CSV files
● all distances to galaxies & actual masses in
single CSV file
Output:
Training, validation & test examples:
● Features:
○ normalized image (matrix of
predefined shape)
○ distance & derived features
● Label:
○ actual mass
10 Create & train model
Input:
Training, validation & test examples
Process:
● build model that predicts labels based on
features,
● fit model on training data,
● tune hyperparameters
● iterate
Output:
Best model fitted on the training data with
optimal hyperparameters
11 Deploy trained model
Input:
Best model fitted on the training data with
optimal hyperparameters
Output:
API that accepts input data for a single galaxy:
● 1 grayscale image
● distance to galaxy
and returns the predicted stellar mass
12 Outline
Dissecting a Machine Learning Project
Mapping the components to GCP tools
Building a boilerplate example
1
2
3
13 Google Cloud Products
Compute Storage
Data &
Analytics
Machine
Learning
14 GCP: Open Cloud Philosophy
● Powerful Open Source Frameworks that run everywhere
● Fully Managed Services to run it more easily
Cloud Machine
Learning Engine
TensorFlow
Cloud
Dataflow
Apache
Beam
15 Mapping to GCP Products
Collect
data
Create
model
Train model with
organized data
Organize
data
Deploy trained
model
Cloud Machine
Learning Engine
Cloud
Dataflow
Cloud Machine
Learning Engine
Cloud
Storage
Tensorflow
16 Datalab/Jupyter notebooks to experiment & iterate
Collect
data
Create
model
Train model with
organized data
Organize
data
Deploy trained
model
Iterate
17 Google Cloud Storage (GCS)
● Object Storage Service
● Your data lives here:
○ Raw input data
○ Cleaned examples for TF models
○ Serialized Tensorflow models
● Single interface/API, multiple
offerings
Name Access Frequency
Multi-Regional Frequent, Cross-regional
Regional Frequent, Single-region
Nearline Less than once per month
Coldline Less than once per year
18 Apache Beam running on Cloud Dataflow
● Open source, unified model for defining both
batch and streaming data-parallel processing
pipelines.
● Using one of the open source Beam SDKs, you
build a program that defines the pipeline.
● The pipeline is then executed by one of Beam’s
supported distributed processing back-ends,
which include Apache Apex, Apache Flink,
Apache Spark, and Google Cloud Dataflow.
Beam Model: Fn Runners
Apache
Flink
Apache
Spark
Beam Model: Pipeline
Construction
Other
LanguagesBeam Java
Beam
Python
Execution Execution
Cloud
Dataflow
Execution
Source: https://beam.apache.org
19 Apache Beam key concepts
● Pipelines: data processing job made of a
series of computations including input,
processing, and output
● PCollections: bounded (or unbounded)
datasets which represent the input,
intermediate and output data in pipelines
● PTransforms: data processing step in a
pipeline in which one or more PCollections are
an input and output
● I/O Sources and Sinks: APIs for reading and
writing data which are the roots and
endpoints of the pipeline.
Source: https://beam.apache.org
20 Apache Beam running on Cloud Dataflow
● Fully-managed data processing service
to run Apache Beam pipelines:
○ Automated and optimized
work partitioning which can
dynamically rebalance lagging work
○ Horizontal dynamic autoscaling of
worker resources
21 Collect & organize data with Cloud Dataflow
Astrohack use case steps:
● Read:
○ Metadata from 1 csv-file
○ Image data from 76k csv-files
● Combine datasets
● Preprocess and build Tensorflow
examples
● Split into train/validation/test set
● Write to TFRecords on GCS
22 Collect & organize data with Cloud Dataflow
1 1
2
2
3 3
4
4
5
5
23 Tensorflow
● Open-source library for machine learning
● Single API for multiple platforms/devices:
cpu(s), gpu(s),tpu(s), mobile phones...
● 2 step approach:
○ Construct your model as a
computational graph
○ Train your model by pushing data
through the graph
● Big community with lots of SotA model
implementations
24 ML Engine Training
● Tensorflow Training As a Service
● Data needs to be available online
● No fancy interface (only logging +
Tensorboard)
● Same code can run locally to test on small
datasets
● Nice features:
○ Easy setup of (GPU) clusters for
distributed Tensorflow models
○ Automatic parallel hyperparameter
tuning with Hypertune
25 ML Engine Training with contrib.learn and TFRecords on GCS
26 ML Engine Predictions
● Deploy trained model:
○ model (container)
○ version (actual code)
● Predictions:
○ batch
○ online
● Autoscaling
27 ML Engine Predictions
28 GCP components for ML summarized
Google Cloud Storage
● All your data lives here
● Very fast access from other GCP services
Cloud Dataflow
● Best place to run Apache Beam Pipelines
● Automatically & dynamically scales to 1000’s of cores
Cloud ML Engine
● Best place to train & deploy Tensorflow models
● Easy access to clusters of GPU machines to:
○ Train distributed model on multiple machines
○ Automate hyperparameter tuning (in parallel)
● Autoscales the number of serving nodes in response to request traffic
29 Outline
Dissecting a Machine Learning Project
Mapping the components to GCP tools
Building a boilerplate example
1
2
3
30 Boilerplate example
● Starterkit to deploy your Tensorflow project on Google Cloud Platform
● Structure based on the ML Engine samples, simplified
● Usage:
○ build locally on a sample on the dataset (faster for small datasets)
○ run in the cloud on the complete dataset (faster for large datasets)
● Functionalities:
○ preprocess data with Apache Beam (make TFRecords)
○ train Tensorflow model
○ deploy Tensorflow model
○ scalable inferences with ML Engine
31 Boilerplate example (bit.ly/mlboilerplate)
Link:
ANNEX
32
33 What I didn’t cover
Other (big) data services Ready to use Machine Learning models
Cloud
Vision API
Cloud
Translation API
Cloud Natural
Language API
Cloud
Speech API
Cloud
Jobs API
Cloud Video
Inelligence
Cloud
Datalab
Cloud
Dataproc
Cloud
Dataprep
BigQuery
34 Further reading
Getting Started:
● GCP-ML boilerplate: https://github.com/Fematich/mlengine-boilerplate
● Apache Beam Programming Guide: https://beam.apache.org/documentation/programming-guide
● Tensorflow Getting Started: https://www.tensorflow.org/get_started
● ML Engine documentation: https://cloud.google.com/ml-engine/docs
● Machine Learning Workflow: https://cloud.google.com/ml-engine/docs/concepts/ml-solutions-overview
● Gcloud commands: https://cloud.google.com/sdk/gcloud/reference/ml-engine/
Next Steps:
● Tensorflow Model Zoo: https://github.com/tensorflow/models
● Tensorflow Serving with Kubernetes: https://tensorflow.github.io/serving/serving_inception
● Tensorflow Transform (Preprocessing for ML Engine):
https://research.googleblog.com/2017/02/preprocessing-for-machine-learning-with.html
● Cloudml-magic (Jupyter Notebook magic cmds for ML Engine): https://github.com/hayatoy/cloudml-magic
● Best Practices for ML Engineering: http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf
● How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native:
http://bit.ly/2w0YWlh
Meetups (Belgium):
● https://www.meetup.com/GDG-Cloud-Belgium
● https://www.meetup.com/TensorFlow-Belgium
Thank you!
@FsMatt

More Related Content

What's hot

Machine Learning & Amazon SageMaker
Machine Learning & Amazon SageMakerMachine Learning & Amazon SageMaker
Machine Learning & Amazon SageMaker
Amazon Web Services
 
MLOps for production-level machine learning
MLOps for production-level machine learningMLOps for production-level machine learning
MLOps for production-level machine learning
cnvrg.io AI OS - Hands-on ML Workshops
 

What's hot (20)

BigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQLBigQuery ML - Machine learning at scale using SQL
BigQuery ML - Machine learning at scale using SQL
 
Predicting Flights with Azure Databricks
Predicting Flights with Azure DatabricksPredicting Flights with Azure Databricks
Predicting Flights with Azure Databricks
 
MLflow with Databricks
MLflow with DatabricksMLflow with Databricks
MLflow with Databricks
 
MLOps in action
MLOps in actionMLOps in action
MLOps in action
 
Machine Learning & Amazon SageMaker
Machine Learning & Amazon SageMakerMachine Learning & Amazon SageMaker
Machine Learning & Amazon SageMaker
 
Data & Analytics ReInvent Recap [AWS Basel Meetup - Jan 2023].pdf
Data & Analytics ReInvent Recap [AWS Basel Meetup - Jan 2023].pdfData & Analytics ReInvent Recap [AWS Basel Meetup - Jan 2023].pdf
Data & Analytics ReInvent Recap [AWS Basel Meetup - Jan 2023].pdf
 
How to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platformHow to migrate workloads to the google cloud platform
How to migrate workloads to the google cloud platform
 
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
 
Unified MLOps: Feature Stores & Model Deployment
Unified MLOps: Feature Stores & Model DeploymentUnified MLOps: Feature Stores & Model Deployment
Unified MLOps: Feature Stores & Model Deployment
 
MLOps Using MLflow
MLOps Using MLflowMLOps Using MLflow
MLOps Using MLflow
 
Data in Motion: Building Stream-Based Architectures with Qlik Replicate & Kaf...
Data in Motion: Building Stream-Based Architectures with Qlik Replicate & Kaf...Data in Motion: Building Stream-Based Architectures with Qlik Replicate & Kaf...
Data in Motion: Building Stream-Based Architectures with Qlik Replicate & Kaf...
 
Big Data and ML on Google Cloud
Big Data and ML on Google CloudBig Data and ML on Google Cloud
Big Data and ML on Google Cloud
 
Deploy and Serve Model from Azure Databricks onto Azure Machine Learning
Deploy and Serve Model from Azure Databricks onto Azure Machine LearningDeploy and Serve Model from Azure Databricks onto Azure Machine Learning
Deploy and Serve Model from Azure Databricks onto Azure Machine Learning
 
Machine Learning Operations & Azure
Machine Learning Operations & AzureMachine Learning Operations & Azure
Machine Learning Operations & Azure
 
MLOps for production-level machine learning
MLOps for production-level machine learningMLOps for production-level machine learning
MLOps for production-level machine learning
 
Dagster - DataOps and MLOps for Machine Learning Engineers.pdf
Dagster - DataOps and MLOps for Machine Learning Engineers.pdfDagster - DataOps and MLOps for Machine Learning Engineers.pdf
Dagster - DataOps and MLOps for Machine Learning Engineers.pdf
 
Seamless End-to-End Production Machine Learning with Seldon and MLflow
 Seamless End-to-End Production Machine Learning with Seldon and MLflow Seamless End-to-End Production Machine Learning with Seldon and MLflow
Seamless End-to-End Production Machine Learning with Seldon and MLflow
 
Building modern data lakes
Building modern data lakes Building modern data lakes
Building modern data lakes
 
Build, train and deploy ML models at scale.pdf
Build, train and deploy ML models at scale.pdfBuild, train and deploy ML models at scale.pdf
Build, train and deploy ML models at scale.pdf
 
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full LifecycleMLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
MLOps Virtual Event | Building Machine Learning Platforms for the Full Lifecycle
 

Similar to Machine learning at scale with Google Cloud Platform

Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
Databricks
 

Similar to Machine learning at scale with Google Cloud Platform (20)

Architecting Analytic Pipelines on GCP - Chicago Cloud Conference 2020
Architecting Analytic Pipelines on GCP - Chicago Cloud Conference 2020Architecting Analytic Pipelines on GCP - Chicago Cloud Conference 2020
Architecting Analytic Pipelines on GCP - Chicago Cloud Conference 2020
 
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)Building a Data Pipeline using Apache Airflow (on AWS / GCP)
Building a Data Pipeline using Apache Airflow (on AWS / GCP)
 
Machine learning at scale by Amy Unruh from Google
Machine learning at scale by  Amy Unruh from GoogleMachine learning at scale by  Amy Unruh from Google
Machine learning at scale by Amy Unruh from Google
 
Google Dremel. Concept and Implementations.
Google Dremel. Concept and Implementations.Google Dremel. Concept and Implementations.
Google Dremel. Concept and Implementations.
 
TensorFlow 16: Building a Data Science Platform
TensorFlow 16: Building a Data Science Platform TensorFlow 16: Building a Data Science Platform
TensorFlow 16: Building a Data Science Platform
 
Building Modern Data Pipelines on GCP via a FREE online Bootcamp
Building Modern Data Pipelines on GCP via a FREE online BootcampBuilding Modern Data Pipelines on GCP via a FREE online Bootcamp
Building Modern Data Pipelines on GCP via a FREE online Bootcamp
 
Going deep (learning) with tensor flow and quarkus
Going deep (learning) with tensor flow and quarkusGoing deep (learning) with tensor flow and quarkus
Going deep (learning) with tensor flow and quarkus
 
Big Data Analytics With MATLAB
Big Data Analytics With MATLABBig Data Analytics With MATLAB
Big Data Analytics With MATLAB
 
Introduction to GCP Data Flow Presentation
Introduction to GCP Data Flow PresentationIntroduction to GCP Data Flow Presentation
Introduction to GCP Data Flow Presentation
 
Introduction to GCP DataFlow Presentation
Introduction to GCP DataFlow PresentationIntroduction to GCP DataFlow Presentation
Introduction to GCP DataFlow Presentation
 
Scaling TensorFlow Models for Training using multi-GPUs & Google Cloud ML
Scaling TensorFlow Models for Training using multi-GPUs & Google Cloud MLScaling TensorFlow Models for Training using multi-GPUs & Google Cloud ML
Scaling TensorFlow Models for Training using multi-GPUs & Google Cloud ML
 
Day 13 - Creating Data Processing Services | Train the Trainers Program
Day 13 - Creating Data Processing Services | Train the Trainers ProgramDay 13 - Creating Data Processing Services | Train the Trainers Program
Day 13 - Creating Data Processing Services | Train the Trainers Program
 
Session 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers ProgramSession 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers Program
 
Infrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload DeploymentInfrastructure Agnostic Machine Learning Workload Deployment
Infrastructure Agnostic Machine Learning Workload Deployment
 
On-device ML with TFLite
On-device ML with TFLiteOn-device ML with TFLite
On-device ML with TFLite
 
Structured Streaming in Spark
Structured Streaming in SparkStructured Streaming in Spark
Structured Streaming in Spark
 
GCP Slide.pptx
GCP Slide.pptxGCP Slide.pptx
GCP Slide.pptx
 
Sawmill - Integrating R and Large Data Clouds
Sawmill - Integrating R and Large Data CloudsSawmill - Integrating R and Large Data Clouds
Sawmill - Integrating R and Large Data Clouds
 
Building an analytics workflow using Apache Airflow
Building an analytics workflow using Apache AirflowBuilding an analytics workflow using Apache Airflow
Building an analytics workflow using Apache Airflow
 
Integrating Google Cloud Dataproc with Alluxio for faster performance in the ...
Integrating Google Cloud Dataproc with Alluxio for faster performance in the ...Integrating Google Cloud Dataproc with Alluxio for faster performance in the ...
Integrating Google Cloud Dataproc with Alluxio for faster performance in the ...
 

Recently uploaded

Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
only4webmaster01
 

Recently uploaded (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 

Machine learning at scale with Google Cloud Platform

  • 1. Machine Learning at scale with GCP using ML Engine & Python Dataflow 19/09/2017 Matthias Feys
  • 2. 2 About ML6/Datatonic We are a team of data scientists, machine learning experts, software engineers and mathematicians. Our mission is to provide tailor-made systems to help your organization get smart actionable insights from large data volumes. + Specialized Machine Learning partner of Google Cloud Matthias Feys GDE for ML and GCP @FsMatt - matthiasfeys@gmail.com
  • 3. 3 Outline Dissecting a Machine Learning Project Mapping the components to GCP tools Building a boilerplate example 1 2 3
  • 4. 4 Opinionated view Focus on tooling not complete overview no focus on models no focus business Caveats
  • 5. 5 Outline Dissecting a Machine Learning Project Mapping the components to GCP tools Building a boilerplate example 1 2 3
  • 6. 6 Popular image of what ML is Lots of data Magical resultsComplex mathematics in multidimensional spaces
  • 7. 7 In reality, ML is Collect data Create model Train model with organized data Organize data Deploy trained model iterate
  • 8. 8 Concrete use case: predict stellar masses* *data and problem of the 1st DSGhent hackathon: https://astrohack.org Predict stellar mass based on: ● image of galaxy ● distance to galaxy
  • 9. 9 Collect & organize data Input: 76k labelled galaxies: ● 1 grayscale image in different CSV files ● all distances to galaxies & actual masses in single CSV file Output: Training, validation & test examples: ● Features: ○ normalized image (matrix of predefined shape) ○ distance & derived features ● Label: ○ actual mass
  • 10. 10 Create & train model Input: Training, validation & test examples Process: ● build model that predicts labels based on features, ● fit model on training data, ● tune hyperparameters ● iterate Output: Best model fitted on the training data with optimal hyperparameters
  • 11. 11 Deploy trained model Input: Best model fitted on the training data with optimal hyperparameters Output: API that accepts input data for a single galaxy: ● 1 grayscale image ● distance to galaxy and returns the predicted stellar mass
  • 12. 12 Outline Dissecting a Machine Learning Project Mapping the components to GCP tools Building a boilerplate example 1 2 3
  • 13. 13 Google Cloud Products Compute Storage Data & Analytics Machine Learning
  • 14. 14 GCP: Open Cloud Philosophy ● Powerful Open Source Frameworks that run everywhere ● Fully Managed Services to run it more easily Cloud Machine Learning Engine TensorFlow Cloud Dataflow Apache Beam
  • 15. 15 Mapping to GCP Products Collect data Create model Train model with organized data Organize data Deploy trained model Cloud Machine Learning Engine Cloud Dataflow Cloud Machine Learning Engine Cloud Storage Tensorflow
  • 16. 16 Datalab/Jupyter notebooks to experiment & iterate Collect data Create model Train model with organized data Organize data Deploy trained model Iterate
  • 17. 17 Google Cloud Storage (GCS) ● Object Storage Service ● Your data lives here: ○ Raw input data ○ Cleaned examples for TF models ○ Serialized Tensorflow models ● Single interface/API, multiple offerings Name Access Frequency Multi-Regional Frequent, Cross-regional Regional Frequent, Single-region Nearline Less than once per month Coldline Less than once per year
  • 18. 18 Apache Beam running on Cloud Dataflow ● Open source, unified model for defining both batch and streaming data-parallel processing pipelines. ● Using one of the open source Beam SDKs, you build a program that defines the pipeline. ● The pipeline is then executed by one of Beam’s supported distributed processing back-ends, which include Apache Apex, Apache Flink, Apache Spark, and Google Cloud Dataflow. Beam Model: Fn Runners Apache Flink Apache Spark Beam Model: Pipeline Construction Other LanguagesBeam Java Beam Python Execution Execution Cloud Dataflow Execution Source: https://beam.apache.org
  • 19. 19 Apache Beam key concepts ● Pipelines: data processing job made of a series of computations including input, processing, and output ● PCollections: bounded (or unbounded) datasets which represent the input, intermediate and output data in pipelines ● PTransforms: data processing step in a pipeline in which one or more PCollections are an input and output ● I/O Sources and Sinks: APIs for reading and writing data which are the roots and endpoints of the pipeline. Source: https://beam.apache.org
  • 20. 20 Apache Beam running on Cloud Dataflow ● Fully-managed data processing service to run Apache Beam pipelines: ○ Automated and optimized work partitioning which can dynamically rebalance lagging work ○ Horizontal dynamic autoscaling of worker resources
  • 21. 21 Collect & organize data with Cloud Dataflow Astrohack use case steps: ● Read: ○ Metadata from 1 csv-file ○ Image data from 76k csv-files ● Combine datasets ● Preprocess and build Tensorflow examples ● Split into train/validation/test set ● Write to TFRecords on GCS
  • 22. 22 Collect & organize data with Cloud Dataflow 1 1 2 2 3 3 4 4 5 5
  • 23. 23 Tensorflow ● Open-source library for machine learning ● Single API for multiple platforms/devices: cpu(s), gpu(s),tpu(s), mobile phones... ● 2 step approach: ○ Construct your model as a computational graph ○ Train your model by pushing data through the graph ● Big community with lots of SotA model implementations
  • 24. 24 ML Engine Training ● Tensorflow Training As a Service ● Data needs to be available online ● No fancy interface (only logging + Tensorboard) ● Same code can run locally to test on small datasets ● Nice features: ○ Easy setup of (GPU) clusters for distributed Tensorflow models ○ Automatic parallel hyperparameter tuning with Hypertune
  • 25. 25 ML Engine Training with contrib.learn and TFRecords on GCS
  • 26. 26 ML Engine Predictions ● Deploy trained model: ○ model (container) ○ version (actual code) ● Predictions: ○ batch ○ online ● Autoscaling
  • 27. 27 ML Engine Predictions
  • 28. 28 GCP components for ML summarized Google Cloud Storage ● All your data lives here ● Very fast access from other GCP services Cloud Dataflow ● Best place to run Apache Beam Pipelines ● Automatically & dynamically scales to 1000’s of cores Cloud ML Engine ● Best place to train & deploy Tensorflow models ● Easy access to clusters of GPU machines to: ○ Train distributed model on multiple machines ○ Automate hyperparameter tuning (in parallel) ● Autoscales the number of serving nodes in response to request traffic
  • 29. 29 Outline Dissecting a Machine Learning Project Mapping the components to GCP tools Building a boilerplate example 1 2 3
  • 30. 30 Boilerplate example ● Starterkit to deploy your Tensorflow project on Google Cloud Platform ● Structure based on the ML Engine samples, simplified ● Usage: ○ build locally on a sample on the dataset (faster for small datasets) ○ run in the cloud on the complete dataset (faster for large datasets) ● Functionalities: ○ preprocess data with Apache Beam (make TFRecords) ○ train Tensorflow model ○ deploy Tensorflow model ○ scalable inferences with ML Engine
  • 31. 31 Boilerplate example (bit.ly/mlboilerplate) Link:
  • 33. 33 What I didn’t cover Other (big) data services Ready to use Machine Learning models Cloud Vision API Cloud Translation API Cloud Natural Language API Cloud Speech API Cloud Jobs API Cloud Video Inelligence Cloud Datalab Cloud Dataproc Cloud Dataprep BigQuery
  • 34. 34 Further reading Getting Started: ● GCP-ML boilerplate: https://github.com/Fematich/mlengine-boilerplate ● Apache Beam Programming Guide: https://beam.apache.org/documentation/programming-guide ● Tensorflow Getting Started: https://www.tensorflow.org/get_started ● ML Engine documentation: https://cloud.google.com/ml-engine/docs ● Machine Learning Workflow: https://cloud.google.com/ml-engine/docs/concepts/ml-solutions-overview ● Gcloud commands: https://cloud.google.com/sdk/gcloud/reference/ml-engine/ Next Steps: ● Tensorflow Model Zoo: https://github.com/tensorflow/models ● Tensorflow Serving with Kubernetes: https://tensorflow.github.io/serving/serving_inception ● Tensorflow Transform (Preprocessing for ML Engine): https://research.googleblog.com/2017/02/preprocessing-for-machine-learning-with.html ● Cloudml-magic (Jupyter Notebook magic cmds for ML Engine): https://github.com/hayatoy/cloudml-magic ● Best Practices for ML Engineering: http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf ● How HBO’s Silicon Valley built “Not Hotdog” with mobile TensorFlow, Keras & React Native: http://bit.ly/2w0YWlh Meetups (Belgium): ● https://www.meetup.com/GDG-Cloud-Belgium ● https://www.meetup.com/TensorFlow-Belgium