SlideShare a Scribd company logo
Supercharge your data analytics with
BigQuery ML
November 2020
Márton Kodok / @martonkodok
Google Developer Expert at REEA.net
● Among the Top3 romanians on Stackoverflow 175k reputation
● Google Developer Expert on Cloud technologies
● Crafting Web/Mobile backends at REEA.net
● BigQuery + Redis database engine expert
Slideshare: martonkodok
Twitter: @martonkodok
StackOverflow: pentium10
GitHub: pentium10
Supercharge your data analytics with BigQuery ML @martonkodok
About me
1. E-commerce Workloads and data models
2. What is BigQuery? - Data warehouse in the Cloud
3. Introduction to BigQuery ML - execute ML models using SQL
4. Practical use cases
5. Predict, recommend and forecastwith BigQuery ML
6. Conclusions
Agenda
Supercharge your data analytics with BigQuery ML @martonkodok
Shop - products, tagging, features, attributes
Users profile, preferences, favorites, rating, engagement
Customers orders, re-orders, profile, associated products, survey, feedback, 360°
Analytics metrics, event data, page hits, email campaigns, A/B split tests
Upsells recommendations, price tags, strategy, discounts, vouchers
Enriched data sku, sentiment analysis, image parsing, object recognition
E-commerce Workloads and data models
Supercharge your data analytics with BigQuery ML @martonkodok
Shop - products, tagging, features, attributes
Users profile, preferences, favorites, rating, engagement
Customers orders, re-orders, profile, associated products, survey, feedback, 360°
Analytics metrics, event data, page hits, email campaigns, A/B split tests
Upsells recommendations, price tags, strategy, discounts, vouchers
Enriched data sku, sentiment analysis, image parsing, object recognition
E-commerce Workloads and data models
Supercharge your data analytics with BigQuery ML @martonkodok
“ Where to store all these
rawdata?
Supercharge your data analytics with BigQuery ML @martonkodok
BigQuery
On-Premises Servers
ApplicationEvents
Frontend
Metrics / Logs/
Streaming
Supercharge your data analytics with BigQuery ML @martonkodok
SQL
Analytics-as-a-Service - Data Warehouse in the Cloud
Familiar DB Structure (table, columns, views, struct, nested, JSON)
Decent pricing (storage: $20/TB cold: $10/TB,queries $5/TB) *Nov 2020
SQL 2011 + Javascript UDF (User Defined Functions)
BigQuery ML enables users to create machine learning models by SQL queries
Scales into Petabytes on Managed Infrastructure
Integrates with Cloud SQL + Cloud Storage + Sheets + Pub/Sub connectors
What is BigQuery?
Supercharge your data analytics with BigQuery ML @martonkodok
What is BigQuery’s Superpower?
Supercharge your data analytics with BigQuery ML @martonkodok
1. Load from file - either local or from GCS (max 5TB each)
2. Streaming rows - event driven approach - high throughput 1M rows/sec
3. Functions - observer-trigger based (Google Cloud Functions)
4. Join with Cloud SQL - Ability to join with MySQL, Postgres
5. Pipelines - flexibility to do ETL - FluentD, Kafka, Google Dataflow
6. Export from connected services - Firestore, Billing, AuditLogs, Stackdriver
7. Firebase - Analytics - Messaging - Crashlytics - Perf. Monitoring - Predictions
Loading Data into BigQuery
Supercharge your data analytics with BigQuery ML @martonkodok
“ Capturing the data
Supercharge your data analytics with BigQuery ML @martonkodok
Data Pipeline Integration at REEA.net
Analytics Backend
BigQuery
On-Premises Servers
Pipelines
FluentD
Event Sourcing
Frontend
Platform Services
Metrics / Logs/
Streaming
Development
Team
Data Analysts
Report & Share
Business Analysis
Tools
Tableau
QlikView
Data Studio
Internal
Dashboard
Database
SQL
Application
ServersServers
Cloud Storage
archive
Load
Export
Replay
Standard
Devices
HTTPS
Supercharge your data analytics with BigQuery ML @martonkodok
“ We have our app outside of GCP.
We need to join with our SQL database.
Solution: EXTERNAL_QUERY
Supercharge your data analytics with BigQuery ML @martonkodok
Combine on-premise with Cloud
App
Load
Balancing
NGINX
Compute Engine
10GB PD
2 1
Database Service (Master/Slave)
Compute Engine
10GB PD
4 1
Compute Engine
10GB PD
4 1
Compute Engine
10GB PD
4 1
BigQuery
Supercharge your data analytics with BigQuery ML @martonkodok
Zone 1
us-east1-a
Replica
Cloud SQL
Cloud
VPN
Gateway
Execute combined
queries
Report
EXTERNAL_QUERY: Run in BQ a query from Cloud SQL db
Supercharge your data analytics with BigQuery ML @martonkodok
●
●
●
●
●
●
●
Our benefits
Supercharge your data analytics with BigQuery ML @martonkodok
What is BigQueryML?
Supercharge your data analytics with BigQuery ML @martonkodok
BigQuery ML
1. CREATE MODEL in SQL to increase
development speed
2. Predict, recommend, foreast on tabular
data with SQL
3. Automate common ML tasks and
hyperparameter tuning by creating new
models as easy ascreatingtables
● Binary or Multiclass logistic regression for classification (labels can have up to 50 unique values)
● K-means clustering for data segmentation (unsupervised learning - not require labels/training)
● Recommend with Matrix factorization
● Import TensorFlow models for prediction in BigQuery
● Time series forecasting with ARIMA - the sales of an item on a given day
● Boosted Tree for creating XGBoost | Deep Neural Network DNN models | AutoML tables
● and others...
Supported models in BigQuery ML
Supercharge your data analytics with BigQuery ML @martonkodok
Conversion/Purchase prediction MODEL: Logistic-Regression
Predict if a user “converts” or "purchases". It is in the company's interest if many users sign up for this
membership as it helps streamline their Ads convertion and also helps with recurring revenue.
Customer Lifetime Value (LTV) prediction. MODEL: Logistic-Regression
It is used by the organisations to identify and prioritizesignificantcustomersegments that would be most
valuable to the company.
Customer Segmentation MODEL: K-means clustering
dividing a client base into groups in specific ways relevanttomarketing, such as interestsandspending
habits. Segmentation allows marketers to better customize their efforts to various audience groups.
E-commerce Use Cases
Supercharge your data analytics with BigQuery ML @martonkodok
Create a MODELthat predicts whether a website visitor will make a transaction.
● CREATEMODEL statement
● TheML.EVALUATE function to evaluate the ML model
● TheML.PREDICTfunction to make predictions using the ML model
Getting started with BigQuery ML
Supercharge your data analytics with BigQuery ML @martonkodok
Create a binarylogisticregressionmodel
Supercharge your data analytics with BigQuery ML @martonkodok
3
2
Create training dataset
using a labelcolumn
CREATEMODEL syntax
1
2
SELECT features
3
1
Evaluate your model
Supercharge your data analytics with BigQuery ML @martonkodok
Predict
Supercharge your data analytics with BigQuery ML @martonkodok
Use cases:
● Customer segmentation
● Data quality
Options and defaults
● Number of clusters: Default log10
(num_rows) clusters
● Distance type - Euclidean(default), Cosine
● Supports all major SQL data types including GIS
K-means clustering
Supercharge your data analytics with BigQuery ML @martonkodok
CREATE MODEL yourmodel
OPTIONS (model_type = “kmeans”)
AS SELECT..
FROM
ml.PREDICT maps rows to closest clusters
ml.CENTROID for cluster centroids
ml.EVALUATE
ml.TRAINING_INFO
ml.FEATURE_INFO
Available data:
● Encode yes/no features
(eg: has a microwave, has a kitchen, has a TV, has a bathroom)
● Can apply clustering on the encoded data
K-means clustering: Problem definition
Supercharge your data analytics with BigQuery ML @martonkodok
Premise
We can identify oddities
(potential data quality issues)
by grouping things together
and separating outliers.
K-means clustering: Problem definition
Supercharge your data analytics with BigQuery ML @martonkodok
Use cases:
● Product recommendation
● Marketing campaign target optimization tool
Options and defaults
● Input: User, Item, Rating
● Can use L2 regularization
● Specify training-test split (default random 80-20)
Matrix Factorization
Supercharge your data analytics with BigQuery ML @martonkodok
CREATE MODEL yourmodel
OPTIONS (model_type = “matrix_factorization”)
AS SELECT..
FROM
ml.RECOMMEND for full user-item matrix
ml.EVALUATE
ml.WEIGHTS
ml.TRAINING_INFO
ml.FEATURE_INFO
Available data:
● User
● Item
● Rating
Problem
● assigning values for previously unknown values
(zeros in our case)
Matrix Factorization: Problem definition
Supercharge your data analytics with BigQuery ML @martonkodok
BigQuery ML - Matrix Factorization
Supercharge your data analytics with BigQuery ML @martonkodok
CREATE MODEL wr_temp.purchases_mf_model
options(model_type= 'matrix_factorization' )
as
SELECT user,item,rating FROM `wr_temp.purchases`;
SELECT * FROM
ML.RECOMMEND(MODEL wr_temp.purchases_mf_model);
Step 1
Create a model from a dataset.
Step 2
To view the rating associated with a
given user-item pair, use
ML.RECOMMEND with the model name.
The output will return a rating
for each user-item pair.
Use cases:
● All sort of time series data forecast
● Marketing campaign target optimization tool
Options and defaults
● Holiday effects adjustments by Region
● Seasonal and trend decomposition
● Auto data frequency detection
Time Series forecasting with ARIMA model
Supercharge your data analytics with BigQuery ML @martonkodok
CREATE MODEL yourmodel
OPTIONS (model_type = “ARIMA”)
AS SELECT..
ml.FORECAST to be use with HORIZON
ml.EVALUATE
ml.ARIMA_COEFFICIENTS
Available data:
● Past Timestamp
● Past Value
Problem
● Forecasts for next X slots (called horizon)
Time Series forecasting with ARIMA model
Supercharge your data analytics with BigQuery ML @martonkodok
SELECT forecast_timestamp, forecast_value FROM
ML.FORECAST(MODEL bqml_tutorial.nyc_citibike_arima_model,
STRUCT(300 AS horizon, 0.8 AS confidence_level))
Use cases:
● Easily add TensorFlow predictions to BigQuery
● Build unstructured data models in TensorFlow,
predict in BigQuery
Key restrictions
● Model size limit of 250MB
Import TensorFlow models for prediction
Supercharge your data analytics with BigQuery ML @martonkodok
CREATE MODEL yourmodel
OPTIONS (model_type =“tensorflow”,
Model_path =’gs://’)
ml.PREDICT()
DEMO
Search 'QueryIt Smart' on GitHub to learn more.
Google Drive - Collaboratory - Jupyter Notebook
Supercharge your data analytics with BigQuery ML @martonkodok
New on BigQuery UI - Evaluation charts
Supercharge your data analytics with BigQuery ML @martonkodok
Conclusions
Supercharge your data analytics with BigQuery ML @martonkodok
Automation
● Run the process daily
● Determine hyperparameters
● Surface the results and route them somewhere for inspection and improvement
Testing
● AB test around impact of data quality on conversion and customer NPS (net promoter score)
Improvements
● Determine, and explore outliers
● Repeat, automate
Considerations
Supercharge your data analytics with BigQuery ML @martonkodok
● Democratizes the use of ML by empowering data analysts to build and run models using existing
business intelligence tools and spreadsheets
● Generalist team. Models are trained using SQL. There is no need to program an ML solution using
Python or Java.
● Increases the innovation and speed of model development by removing the need to export data from
the data warehouse.
● A Model serves a purpose. Easy to change/recycle.
Benefits of BigQuery ML
Supercharge your data analytics with BigQuery ML @martonkodok
The possibilities are endless
Supercharge your data analytics with BigQuery ML @martonkodok
Marketing Retail IndustrialandIoT Media/gaming
Predict customer value
Predict funnel conversion
Personalize ads, email,
webpage content
Optimize inventory
Forecast revenue
Enable product
recommendations
Optimize staff promotions
Forecast demand for
parking, traffic utilities,
personnel
Prevent equipment
downtime
Predict maintenance needs
Personalize content
Predict game difficulty
Predict player lifetime value
Thank you.
Slides available on:
slideshare.net/martonkodok
Reea.net - Integrated web solutions driven by creativity
to deliver projects.

More Related Content

PDF
BigQuery ML - Machine learning at scale using SQL
PDF
Serverless orchestration and automation with Cloud Workflows
PDF
Serverless orchestration and automation with Cloud Workflows
PDF
Supercharge your data analytics with BigQuery
PDF
BigQuery ML - Machine learning at scale using SQL
PDF
DevFest Romania 2020 Keynote: Bringing the Cloud to you.
PPTX
GraphQL research summary
PDF
GraphQL London January 2018: Graphql tooling
BigQuery ML - Machine learning at scale using SQL
Serverless orchestration and automation with Cloud Workflows
Serverless orchestration and automation with Cloud Workflows
Supercharge your data analytics with BigQuery
BigQuery ML - Machine learning at scale using SQL
DevFest Romania 2020 Keynote: Bringing the Cloud to you.
GraphQL research summary
GraphQL London January 2018: Graphql tooling

What's hot (20)

PDF
GraphQL Advanced
PDF
ML, Statistics, and Spark with Databricks for Maximizing Revenue in a Delayed...
PDF
Next18 Extended Targu Mures - Bringing the Cloud to you
PDF
Automated Apache Kafka Mocking and Testing with AsyncAPI | Hugo Guerrero, Red...
PDF
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
PPTX
Kafka Connect and KSQL: Useful Tools in Migrating from a Legacy System to Kaf...
PDF
GraphQL Fundamentals
PDF
Scaling Your Team With GraphQL: Why Relationships Matter
PPTX
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
PDF
Scaling ML-Based Threat Detection For Production Cyber Attacks
PDF
Rethinking Geo-replication for the Cloud | Luke Knepper, Confluent
PPTX
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
PDF
Migrating Your Data Platform At a High Growth Startup
PDF
Unified Data Access with Gimel
PPTX
IIoT_ML_Architechure_AWS
PDF
Scalable crawling with Kafka, scrapy and spark - November 2021
PDF
Apache Kafka and the Data Mesh | Michael Noll, Confluent
PDF
Applied Machine Learning for Ranking Products in an Ecommerce Setting
PDF
Better Together: How Graph database enables easy data integration with Spark ...
PDF
Building event-driven (Micro)Services with Apache Kafka
GraphQL Advanced
ML, Statistics, and Spark with Databricks for Maximizing Revenue in a Delayed...
Next18 Extended Targu Mures - Bringing the Cloud to you
Automated Apache Kafka Mocking and Testing with AsyncAPI | Hugo Guerrero, Red...
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
Kafka Connect and KSQL: Useful Tools in Migrating from a Legacy System to Kaf...
GraphQL Fundamentals
Scaling Your Team With GraphQL: Why Relationships Matter
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Scaling ML-Based Threat Detection For Production Cyber Attacks
Rethinking Geo-replication for the Cloud | Luke Knepper, Confluent
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
Migrating Your Data Platform At a High Growth Startup
Unified Data Access with Gimel
IIoT_ML_Architechure_AWS
Scalable crawling with Kafka, scrapy and spark - November 2021
Apache Kafka and the Data Mesh | Michael Noll, Confluent
Applied Machine Learning for Ranking Products in an Ecommerce Setting
Better Together: How Graph database enables easy data integration with Spark ...
Building event-driven (Micro)Services with Apache Kafka
Ad

Similar to BigdataConference Europe - BigQuery ML (20)

PDF
Applying BigQuery ML on e-commerce data analytics
PDF
Discover BigQuery ML, build your own CREATE MODEL statement
PDF
Democratizing AI/ML with GCP - Abishay Rao (Google) at GoDataFest 2019
PDF
Google Analytics Konferenz 2019_Google Cloud Platform_Carl Fernandes & Ksenia...
PPTX
Introduction Data Warehouse With BigQuery
PPTX
Why Big Query is so Powerful - Trusted Conf
PDF
[Webinar] Getting Started with BigQuery: Basics, Its Appilcations & Use Cases
PDF
Google BigQuery for Everyday Developer
PDF
[Giovanni Galloro] How to use machine learning on Google Cloud Platform
PDF
Ai based analytics in the cloud
PPTX
Getting Started with BigQuery ML
PDF
Modern Thinking área digital MSKM 21/09/2017
PDF
Big query
PPTX
BigQuery Without Analytics 360 - Measurefest 2019 - Adam Englebright
PDF
An overview of BigQuery
PDF
Complex realtime event analytics using BigQuery @Crunch Warmup
PDF
A few Challenges to Make Machine Learning Easy
PPTX
Budapest Data Forum 2017 - BigQuery, Looker And Big Data Analytics At Petabyt...
PDF
Voxxed Days Cluj - Powering interactive data analysis with Google BigQuery
PDF
Database@Home : The Future is Data Driven
Applying BigQuery ML on e-commerce data analytics
Discover BigQuery ML, build your own CREATE MODEL statement
Democratizing AI/ML with GCP - Abishay Rao (Google) at GoDataFest 2019
Google Analytics Konferenz 2019_Google Cloud Platform_Carl Fernandes & Ksenia...
Introduction Data Warehouse With BigQuery
Why Big Query is so Powerful - Trusted Conf
[Webinar] Getting Started with BigQuery: Basics, Its Appilcations & Use Cases
Google BigQuery for Everyday Developer
[Giovanni Galloro] How to use machine learning on Google Cloud Platform
Ai based analytics in the cloud
Getting Started with BigQuery ML
Modern Thinking área digital MSKM 21/09/2017
Big query
BigQuery Without Analytics 360 - Measurefest 2019 - Adam Englebright
An overview of BigQuery
Complex realtime event analytics using BigQuery @Crunch Warmup
A few Challenges to Make Machine Learning Easy
Budapest Data Forum 2017 - BigQuery, Looker And Big Data Analytics At Petabyt...
Voxxed Days Cluj - Powering interactive data analysis with Google BigQuery
Database@Home : The Future is Data Driven
Ad

More from Márton Kodok (20)

PDF
AI Agents with Gemini 2.0 - Beyond the Chatbot
PDF
Gemini 2.0 and Vertex AI for Innovation Workshop
PDF
Function Calling with the Vertex AI Gemini API
PDF
Vector search and multimodal embeddings in BigQuery
PDF
BigQuery Remote Functions for Dynamic Mapping of E-mobility Charging Networks
PDF
Build applications with generative AI on Google Cloud
PDF
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
PDF
DevBCN Vertex AI - Pipelines for your MLOps workflows
PDF
Cloud Run - the rise of serverless and containerization
PDF
BigQuery best practices and recommendations to reduce costs with BI Engine, S...
PDF
Vertex AI - Unified ML Platform for the entire AI workflow on Google Cloud
PDF
Vertex AI: Pipelines for your MLOps workflows
PDF
Cloud Workflows What's new in serverless orchestration and automation
PDF
Serverless orchestration and automation with Cloud Workflows
PDF
Vibe Koli 2019 - Utazás az egyetem padjaitól a Google Developer Expertig
PDF
Google Cloud Platform Solutions for DevOps Engineers
PDF
GDG DevFest Romania - Architecting for the Google Cloud Platform
PDF
6. DISZ - Webalkalmazások skálázhatósága a Google Cloud Platformon
PDF
GCP - A felhőalapú architektúrák és szolgáltatások
PDF
GDG Heraklion - Architecting for the Google Cloud Platform
AI Agents with Gemini 2.0 - Beyond the Chatbot
Gemini 2.0 and Vertex AI for Innovation Workshop
Function Calling with the Vertex AI Gemini API
Vector search and multimodal embeddings in BigQuery
BigQuery Remote Functions for Dynamic Mapping of E-mobility Charging Networks
Build applications with generative AI on Google Cloud
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
DevBCN Vertex AI - Pipelines for your MLOps workflows
Cloud Run - the rise of serverless and containerization
BigQuery best practices and recommendations to reduce costs with BI Engine, S...
Vertex AI - Unified ML Platform for the entire AI workflow on Google Cloud
Vertex AI: Pipelines for your MLOps workflows
Cloud Workflows What's new in serverless orchestration and automation
Serverless orchestration and automation with Cloud Workflows
Vibe Koli 2019 - Utazás az egyetem padjaitól a Google Developer Expertig
Google Cloud Platform Solutions for DevOps Engineers
GDG DevFest Romania - Architecting for the Google Cloud Platform
6. DISZ - Webalkalmazások skálázhatósága a Google Cloud Platformon
GCP - A felhőalapú architektúrák és szolgáltatások
GDG Heraklion - Architecting for the Google Cloud Platform

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Introduction to Artificial Intelligence
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
medical staffing services at VALiNTRY
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
L1 - Introduction to python Backend.pptx
Nekopoi APK 2025 free lastest update
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Which alternative to Crystal Reports is best for small or large businesses.pdf
ai tools demonstartion for schools and inter college
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction to Artificial Intelligence
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
medical staffing services at VALiNTRY
How to Migrate SBCGlobal Email to Yahoo Easily
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo POS Development Services by CandidRoot Solutions
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Design an Analysis of Algorithms I-SECS-1021-03
Navsoft: AI-Powered Business Solutions & Custom Software Development
L1 - Introduction to python Backend.pptx

BigdataConference Europe - BigQuery ML

  • 1. Supercharge your data analytics with BigQuery ML November 2020 Márton Kodok / @martonkodok Google Developer Expert at REEA.net
  • 2. ● Among the Top3 romanians on Stackoverflow 175k reputation ● Google Developer Expert on Cloud technologies ● Crafting Web/Mobile backends at REEA.net ● BigQuery + Redis database engine expert Slideshare: martonkodok Twitter: @martonkodok StackOverflow: pentium10 GitHub: pentium10 Supercharge your data analytics with BigQuery ML @martonkodok About me
  • 3. 1. E-commerce Workloads and data models 2. What is BigQuery? - Data warehouse in the Cloud 3. Introduction to BigQuery ML - execute ML models using SQL 4. Practical use cases 5. Predict, recommend and forecastwith BigQuery ML 6. Conclusions Agenda Supercharge your data analytics with BigQuery ML @martonkodok
  • 4. Shop - products, tagging, features, attributes Users profile, preferences, favorites, rating, engagement Customers orders, re-orders, profile, associated products, survey, feedback, 360° Analytics metrics, event data, page hits, email campaigns, A/B split tests Upsells recommendations, price tags, strategy, discounts, vouchers Enriched data sku, sentiment analysis, image parsing, object recognition E-commerce Workloads and data models Supercharge your data analytics with BigQuery ML @martonkodok
  • 5. Shop - products, tagging, features, attributes Users profile, preferences, favorites, rating, engagement Customers orders, re-orders, profile, associated products, survey, feedback, 360° Analytics metrics, event data, page hits, email campaigns, A/B split tests Upsells recommendations, price tags, strategy, discounts, vouchers Enriched data sku, sentiment analysis, image parsing, object recognition E-commerce Workloads and data models Supercharge your data analytics with BigQuery ML @martonkodok
  • 6. “ Where to store all these rawdata? Supercharge your data analytics with BigQuery ML @martonkodok
  • 7. BigQuery On-Premises Servers ApplicationEvents Frontend Metrics / Logs/ Streaming Supercharge your data analytics with BigQuery ML @martonkodok SQL
  • 8. Analytics-as-a-Service - Data Warehouse in the Cloud Familiar DB Structure (table, columns, views, struct, nested, JSON) Decent pricing (storage: $20/TB cold: $10/TB,queries $5/TB) *Nov 2020 SQL 2011 + Javascript UDF (User Defined Functions) BigQuery ML enables users to create machine learning models by SQL queries Scales into Petabytes on Managed Infrastructure Integrates with Cloud SQL + Cloud Storage + Sheets + Pub/Sub connectors What is BigQuery? Supercharge your data analytics with BigQuery ML @martonkodok
  • 9. What is BigQuery’s Superpower? Supercharge your data analytics with BigQuery ML @martonkodok
  • 10. 1. Load from file - either local or from GCS (max 5TB each) 2. Streaming rows - event driven approach - high throughput 1M rows/sec 3. Functions - observer-trigger based (Google Cloud Functions) 4. Join with Cloud SQL - Ability to join with MySQL, Postgres 5. Pipelines - flexibility to do ETL - FluentD, Kafka, Google Dataflow 6. Export from connected services - Firestore, Billing, AuditLogs, Stackdriver 7. Firebase - Analytics - Messaging - Crashlytics - Perf. Monitoring - Predictions Loading Data into BigQuery Supercharge your data analytics with BigQuery ML @martonkodok
  • 11. “ Capturing the data Supercharge your data analytics with BigQuery ML @martonkodok
  • 12. Data Pipeline Integration at REEA.net Analytics Backend BigQuery On-Premises Servers Pipelines FluentD Event Sourcing Frontend Platform Services Metrics / Logs/ Streaming Development Team Data Analysts Report & Share Business Analysis Tools Tableau QlikView Data Studio Internal Dashboard Database SQL Application ServersServers Cloud Storage archive Load Export Replay Standard Devices HTTPS Supercharge your data analytics with BigQuery ML @martonkodok
  • 13. “ We have our app outside of GCP. We need to join with our SQL database. Solution: EXTERNAL_QUERY Supercharge your data analytics with BigQuery ML @martonkodok
  • 14. Combine on-premise with Cloud App Load Balancing NGINX Compute Engine 10GB PD 2 1 Database Service (Master/Slave) Compute Engine 10GB PD 4 1 Compute Engine 10GB PD 4 1 Compute Engine 10GB PD 4 1 BigQuery Supercharge your data analytics with BigQuery ML @martonkodok Zone 1 us-east1-a Replica Cloud SQL Cloud VPN Gateway Execute combined queries Report
  • 15. EXTERNAL_QUERY: Run in BQ a query from Cloud SQL db Supercharge your data analytics with BigQuery ML @martonkodok
  • 16. ● ● ● ● ● ● ● Our benefits Supercharge your data analytics with BigQuery ML @martonkodok
  • 17. What is BigQueryML? Supercharge your data analytics with BigQuery ML @martonkodok
  • 18. BigQuery ML 1. CREATE MODEL in SQL to increase development speed 2. Predict, recommend, foreast on tabular data with SQL 3. Automate common ML tasks and hyperparameter tuning by creating new models as easy ascreatingtables
  • 19. ● Binary or Multiclass logistic regression for classification (labels can have up to 50 unique values) ● K-means clustering for data segmentation (unsupervised learning - not require labels/training) ● Recommend with Matrix factorization ● Import TensorFlow models for prediction in BigQuery ● Time series forecasting with ARIMA - the sales of an item on a given day ● Boosted Tree for creating XGBoost | Deep Neural Network DNN models | AutoML tables ● and others... Supported models in BigQuery ML Supercharge your data analytics with BigQuery ML @martonkodok
  • 20. Conversion/Purchase prediction MODEL: Logistic-Regression Predict if a user “converts” or "purchases". It is in the company's interest if many users sign up for this membership as it helps streamline their Ads convertion and also helps with recurring revenue. Customer Lifetime Value (LTV) prediction. MODEL: Logistic-Regression It is used by the organisations to identify and prioritizesignificantcustomersegments that would be most valuable to the company. Customer Segmentation MODEL: K-means clustering dividing a client base into groups in specific ways relevanttomarketing, such as interestsandspending habits. Segmentation allows marketers to better customize their efforts to various audience groups. E-commerce Use Cases Supercharge your data analytics with BigQuery ML @martonkodok
  • 21. Create a MODELthat predicts whether a website visitor will make a transaction. ● CREATEMODEL statement ● TheML.EVALUATE function to evaluate the ML model ● TheML.PREDICTfunction to make predictions using the ML model Getting started with BigQuery ML Supercharge your data analytics with BigQuery ML @martonkodok
  • 22. Create a binarylogisticregressionmodel Supercharge your data analytics with BigQuery ML @martonkodok 3 2 Create training dataset using a labelcolumn CREATEMODEL syntax 1 2 SELECT features 3 1
  • 23. Evaluate your model Supercharge your data analytics with BigQuery ML @martonkodok
  • 24. Predict Supercharge your data analytics with BigQuery ML @martonkodok
  • 25. Use cases: ● Customer segmentation ● Data quality Options and defaults ● Number of clusters: Default log10 (num_rows) clusters ● Distance type - Euclidean(default), Cosine ● Supports all major SQL data types including GIS K-means clustering Supercharge your data analytics with BigQuery ML @martonkodok CREATE MODEL yourmodel OPTIONS (model_type = “kmeans”) AS SELECT.. FROM ml.PREDICT maps rows to closest clusters ml.CENTROID for cluster centroids ml.EVALUATE ml.TRAINING_INFO ml.FEATURE_INFO
  • 26. Available data: ● Encode yes/no features (eg: has a microwave, has a kitchen, has a TV, has a bathroom) ● Can apply clustering on the encoded data K-means clustering: Problem definition Supercharge your data analytics with BigQuery ML @martonkodok
  • 27. Premise We can identify oddities (potential data quality issues) by grouping things together and separating outliers. K-means clustering: Problem definition Supercharge your data analytics with BigQuery ML @martonkodok
  • 28. Use cases: ● Product recommendation ● Marketing campaign target optimization tool Options and defaults ● Input: User, Item, Rating ● Can use L2 regularization ● Specify training-test split (default random 80-20) Matrix Factorization Supercharge your data analytics with BigQuery ML @martonkodok CREATE MODEL yourmodel OPTIONS (model_type = “matrix_factorization”) AS SELECT.. FROM ml.RECOMMEND for full user-item matrix ml.EVALUATE ml.WEIGHTS ml.TRAINING_INFO ml.FEATURE_INFO
  • 29. Available data: ● User ● Item ● Rating Problem ● assigning values for previously unknown values (zeros in our case) Matrix Factorization: Problem definition Supercharge your data analytics with BigQuery ML @martonkodok
  • 30. BigQuery ML - Matrix Factorization Supercharge your data analytics with BigQuery ML @martonkodok CREATE MODEL wr_temp.purchases_mf_model options(model_type= 'matrix_factorization' ) as SELECT user,item,rating FROM `wr_temp.purchases`; SELECT * FROM ML.RECOMMEND(MODEL wr_temp.purchases_mf_model); Step 1 Create a model from a dataset. Step 2 To view the rating associated with a given user-item pair, use ML.RECOMMEND with the model name. The output will return a rating for each user-item pair.
  • 31. Use cases: ● All sort of time series data forecast ● Marketing campaign target optimization tool Options and defaults ● Holiday effects adjustments by Region ● Seasonal and trend decomposition ● Auto data frequency detection Time Series forecasting with ARIMA model Supercharge your data analytics with BigQuery ML @martonkodok CREATE MODEL yourmodel OPTIONS (model_type = “ARIMA”) AS SELECT.. ml.FORECAST to be use with HORIZON ml.EVALUATE ml.ARIMA_COEFFICIENTS
  • 32. Available data: ● Past Timestamp ● Past Value Problem ● Forecasts for next X slots (called horizon) Time Series forecasting with ARIMA model Supercharge your data analytics with BigQuery ML @martonkodok SELECT forecast_timestamp, forecast_value FROM ML.FORECAST(MODEL bqml_tutorial.nyc_citibike_arima_model, STRUCT(300 AS horizon, 0.8 AS confidence_level))
  • 33. Use cases: ● Easily add TensorFlow predictions to BigQuery ● Build unstructured data models in TensorFlow, predict in BigQuery Key restrictions ● Model size limit of 250MB Import TensorFlow models for prediction Supercharge your data analytics with BigQuery ML @martonkodok CREATE MODEL yourmodel OPTIONS (model_type =“tensorflow”, Model_path =’gs://’) ml.PREDICT() DEMO Search 'QueryIt Smart' on GitHub to learn more.
  • 34. Google Drive - Collaboratory - Jupyter Notebook Supercharge your data analytics with BigQuery ML @martonkodok
  • 35. New on BigQuery UI - Evaluation charts Supercharge your data analytics with BigQuery ML @martonkodok
  • 36. Conclusions Supercharge your data analytics with BigQuery ML @martonkodok
  • 37. Automation ● Run the process daily ● Determine hyperparameters ● Surface the results and route them somewhere for inspection and improvement Testing ● AB test around impact of data quality on conversion and customer NPS (net promoter score) Improvements ● Determine, and explore outliers ● Repeat, automate Considerations Supercharge your data analytics with BigQuery ML @martonkodok
  • 38. ● Democratizes the use of ML by empowering data analysts to build and run models using existing business intelligence tools and spreadsheets ● Generalist team. Models are trained using SQL. There is no need to program an ML solution using Python or Java. ● Increases the innovation and speed of model development by removing the need to export data from the data warehouse. ● A Model serves a purpose. Easy to change/recycle. Benefits of BigQuery ML Supercharge your data analytics with BigQuery ML @martonkodok
  • 39. The possibilities are endless Supercharge your data analytics with BigQuery ML @martonkodok Marketing Retail IndustrialandIoT Media/gaming Predict customer value Predict funnel conversion Personalize ads, email, webpage content Optimize inventory Forecast revenue Enable product recommendations Optimize staff promotions Forecast demand for parking, traffic utilities, personnel Prevent equipment downtime Predict maintenance needs Personalize content Predict game difficulty Predict player lifetime value
  • 40. Thank you. Slides available on: slideshare.net/martonkodok Reea.net - Integrated web solutions driven by creativity to deliver projects.