Query Classification
on Steroids
with BERT
Hamlet Batista
@hamletbatista
https://bit.ly/2UVebc1
https://bit.ly/2UVebc1
https://bit.ly/2UVebc1
“Machine learning can help you
understand and predict intent in
ways that simply aren’t possible
manually. It can also help you find
missed or unexpected connections
between business goals and the
habits of your key customer
segments.”
https://bit.ly/2UVebc1
Query Classification on Steroids with BERT
Agenda • We will build a sophisticated deep
learning model that can parse not just
intent but also specific actions like the
ones you give to Google Assistant, Siri and
Alexa.
• We will access the predictive model using
a simple custom function in Google
Sheets.
• We will review the concepts that make this
possible.
• I will share resources you can use to learn
more.
Our Toolkit
https://colab.research.google.com/
We will type our
commands in a
Google Colab
notebook.
Our Toolkit
https://uber.github.io/ludwig/
Ludwig will
help us build
our deep
learning model
without writing
code.
Our Toolkit
https://github.com/howl-anderson/ATIS_dataset
We will train our
model using
the ATIS dataset.
Our Toolkit
https://ngrok.com/
Ngrok will help
us expose the
service URL
inside our
notebook.
Our Toolkit
https://developers.google.com/apps-script
We will code
our Google
Sheets function
using Apps
Script.
Setting up the
notebook
Downloading all required packages
Our Empty Notebook
https://bit.ly/39Fkm9r
Query Classification on Steroids with BERT
Installing
Tensorflow
%tensorflow_version
1.x
!pip install tensorflow-
gpu==1.15.2
import tensorflow as tf;
print(tf.__version__)
!pip install ludwig
!pip install
ludwig[serve]
Installing
Ludwig
https://www.kaggle.com/siddhadev/atis-dataset-clean/home
Connect
Google Drive
from google.colab
import drive
drive.mount("/bert")
%cd '/bert/My
Drive/Writing/Query
Classification on
Steroids with BERT'
!wget
https://bin.equinox.io/
c/4VmDzA7iaHb/ngrok-
stable-linux-amd64.zip
&& unzip ngrok-stable-
linux-amd64.zip
Installing
Ngrok
Preparing the
training data
Setting up the Ludwig configuration file
Query Classification on Steroids with BERT
Creating
model_definition.
yaml
https://gist.github.com/hamletbatista/b523424bb854372288b
b2de325291a13
Building the
predictive model
Running Ludwig with our
configuration file
!ludwig experiment 
--data_csv
atis.train.csv 
--
model_definition_file
model_definition.yaml
Running
Ludwig
Query Classification on Steroids with BERT
Test the predictive
model
Running Ludwig serve
Python code
snippet to test
the model
import pandas as pd
test_df = pd.read_csv("atis.test.csv",
index_col=0)
model =
LudwigModel.load("results/experiment_r
un/model")
predictions = model.predict(test_df)
test_df.reset_index().join(predictions)[["to
kens", "intent_predictions",
"slots_predictions"]]
Query Classification on Steroids with BERT
Serving the
predictive model
Running Ludwig serve
%%bash --bg
nohup ludwig serve -m
results/experiment_run
/model > debug.log
2>&1
!tail debug.log
Running
Ludwig serve
Query Classification on Steroids with BERT
!curl
http://0.0.0.0:8000/pre
dict -X POST -F
'tokens=BOS give me a
flight from baltimore to
newark EOS'
Testing the
service
%%bash --bg
./ngrok http 8000 2>
ngrok.log
!tail ngrok.log
Running
Ngrok
!curl -s
http://localhost:4040/a
pi/tunnels | python3 -c

"import sys, json;
print(json.load(sys.stdi
n)['tunnels'][0]['public_
url'])"
Extracting the
Ngrok public
URL
!curl
https://e769db6e.ngro
k.io/predict -X POST -F
'tokens=BOS explain
meal codes sd d EOS'
Testing the
public service
Our journey
so far
1.We built a travel specific
intent prediction model
2.We can access the model
using a temporary public URL
3.We need to access the URL
from Apps Script and Google
Sheets
Accessing the
predictive model
from Apps Script
Creating a Google Sheets Custom
Function
Query Classification on Steroids with BERT
Creating
fetchPrediction()
https://gist.github.com/hamletbatista/fb7eae2e846ee8c43fff5
a433df2c672
Test
fetchPre
diction()
Query Classification on Steroids with BERT
Query Classification on Steroids with BERT
Testing in Google
Sheets
Calling our custom function
fetchPrediction
Testing in
Google Sheets
Query Classification on Steroids with BERT
Testing in Google Sheets
Where is BERT?
Creating a BERT
model_definition.
yaml
https://gist.github.com/hamletbatista/4d8e6d881b47c1d6b8d
a7ce2cc494579
BERT performs worse!
Resources to
learn more
Python and deep learning resources
1. https://www.searchenginejournal.c
om/author/hamlet-batista/
1. Automated Intent Classification Using
Deep Learning in Google Sheets
2. Automated Intent Classification Using
Deep Learning
3. Automated Intent Classification Using
Deep Learning (Part 2)
2. https://www.jcchouinard.com/pyth
on-for-seo/
1. Python for SEO: Complete Guide (in 5
Chapters)
3. https://moz.com/blog/intro-to-
python
1. Intro to Python - Whiteboard Friday
Thank You!
@hamletbatista
www.ranksense.com/free-tools/
www.linkedin.com/in/
hamletbatista/

More Related Content

PPTX
Delimit Your Data With Google Sheets - #WTSfest 2020
PPTX
Monet BrightonSEO Slides 2022
PDF
Jen Penaluna: Red Light, Green Light Interviewing Potential Employers | Brigh...
PPTX
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
PPTX
Diginius - DuckDuckGo, Privacy and the Future of Search
PDF
BrightonSEO October 2022 - Log File Analysis - Steven van Vessum.pdf
PPTX
Entity seo
PDF
How To Optimize SEO Landing Pages for Search Intent @ BrightonSEO Autumn 2021
Delimit Your Data With Google Sheets - #WTSfest 2020
Monet BrightonSEO Slides 2022
Jen Penaluna: Red Light, Green Light Interviewing Potential Employers | Brigh...
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Diginius - DuckDuckGo, Privacy and the Future of Search
BrightonSEO October 2022 - Log File Analysis - Steven van Vessum.pdf
Entity seo
How To Optimize SEO Landing Pages for Search Intent @ BrightonSEO Autumn 2021

What's hot (20)

PDF
The Ultimate Maturity Audit _ Brighton SEO.pdf
PDF
Core Web Vitals Audit - Sophie Gibson - PDF - BrightonSEO.pdf
PPTX
Brighton SEO 2022: On-page optimization lessons from analyzing over 400 blog ...
PPTX
How to come up with content ideas without relying on search volume.pptx
PDF
SEO-Campixx 2022 | Suchoperatoren auf Steroiden
PPTX
Product, service and category page links (and how to get them) - Rebecca Moss...
PPTX
The Elusive ROI of Content Marketing (by Tim Soulo)
PDF
Giulia Panozzo | Neuroscience of Search | BrightonSEO April 2023
PDF
Improving Crawling and Indexing using Real-Time Log File Insights
PDF
Compound SEO
PPTX
Shining a light on the dark funnel
PDF
[BrightonSEO Oct 2022] Remarketing SEO - Himani Kankaria - Missive Digital.pdf
PDF
BrightonSEO slide deck Oct 2022 - Levi Williams-Clucas - Review Generation an...
PDF
Python For SEO specialists and Content Marketing - Hand in Hand
PDF
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
PDF
[BrightonSEO October 2022] On-page SEO: from intention to conversion
PPTX
How to Automatically Subcategorise Your Website Automatically With Python
PDF
BrightonSEO - Apr 2022 - No excuses for doing UX
PPTX
I Am A Donut: How to Avoid International SEO Mistakes
PDF
How to put together a search strategy for a new category
The Ultimate Maturity Audit _ Brighton SEO.pdf
Core Web Vitals Audit - Sophie Gibson - PDF - BrightonSEO.pdf
Brighton SEO 2022: On-page optimization lessons from analyzing over 400 blog ...
How to come up with content ideas without relying on search volume.pptx
SEO-Campixx 2022 | Suchoperatoren auf Steroiden
Product, service and category page links (and how to get them) - Rebecca Moss...
The Elusive ROI of Content Marketing (by Tim Soulo)
Giulia Panozzo | Neuroscience of Search | BrightonSEO April 2023
Improving Crawling and Indexing using Real-Time Log File Insights
Compound SEO
Shining a light on the dark funnel
[BrightonSEO Oct 2022] Remarketing SEO - Himani Kankaria - Missive Digital.pdf
BrightonSEO slide deck Oct 2022 - Levi Williams-Clucas - Review Generation an...
Python For SEO specialists and Content Marketing - Hand in Hand
How to Incorporate ML in your SERP Analysis, Lazarina Stoy -BrightonSEO Oct, ...
[BrightonSEO October 2022] On-page SEO: from intention to conversion
How to Automatically Subcategorise Your Website Automatically With Python
BrightonSEO - Apr 2022 - No excuses for doing UX
I Am A Donut: How to Avoid International SEO Mistakes
How to put together a search strategy for a new category
Ad

Similar to Query Classification on Steroids with BERT (20)

PPTX
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
PDF
Open erp technical_memento_v0.6.3_a4
PPTX
End-to-end testing with geb
PDF
DevOps Automation with Puppet Bolt & Puppet Enterprise
PDF
Telemetry doesn't have to be scary; Ben Ford
PDF
Ben ford intro
PDF
I want my model to be deployed ! (another story of MLOps)
PDF
PVS-Studio in the Clouds: Azure DevOps
PDF
Backstage Software Templates for Java Developers
PDF
OpenWhisk by Example - Auto Retweeting Example in Python
ODP
Knolx session
PDF
Google App Engine in 40 minutes (the absolute essentials)
PDF
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
PDF
Agile Data Science 2.0: Using Spark with MongoDB
PPTX
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
PPT
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
PPTX
Grails Advanced
PPT
Rails Rookies Bootcamp - Blogger
PDF
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
PDF
Rapid Prototyping with TurboGears2
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
Open erp technical_memento_v0.6.3_a4
End-to-end testing with geb
DevOps Automation with Puppet Bolt & Puppet Enterprise
Telemetry doesn't have to be scary; Ben Ford
Ben ford intro
I want my model to be deployed ! (another story of MLOps)
PVS-Studio in the Clouds: Azure DevOps
Backstage Software Templates for Java Developers
OpenWhisk by Example - Auto Retweeting Example in Python
Knolx session
Google App Engine in 40 minutes (the absolute essentials)
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Agile Data Science 2.0: Using Spark with MongoDB
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Grails Advanced
Rails Rookies Bootcamp - Blogger
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Rapid Prototyping with TurboGears2
Ad

More from Hamlet Batista (20)

PDF
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
PDF
Automated Duplicate Content Consolidation with Google Cloud Functions
PDF
Quality Content at Scale Through Automated Text Summarization of UGC
PDF
SEO Meets Automation
PDF
Automating Google Lighthouse
PDF
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
PDF
The Python Cheat Sheet for the Busy Marketer
PPTX
Doing More with Less: Automated, High-Quality Content Generation
PPTX
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
PPTX
Agile SEO: Faster SEO Results
PPTX
Scaling Keyword Research to Find Content Gaps
PPTX
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
PPTX
Python for Data-driven Storytelling
PPTX
Scaling automated quality text generation for enterprise sites
PPTX
The New Renaissance of JavaScript
PPTX
Data and Evidence-driven SEO
PPTX
Python for SEO
PPTX
Advanced Data-Driven SEO
PPTX
Technical SEO "Overoptimization"
PPTX
Why Pay for Performance When You Can Lead the World To Your Door for Free?
A Deep Dive Into SEO Tactics For Modern Javascript Frameworks
Automated Duplicate Content Consolidation with Google Cloud Functions
Quality Content at Scale Through Automated Text Summarization of UGC
SEO Meets Automation
Automating Google Lighthouse
Creando una Sección de FAQS y su Marcado de Datos Estructurados en 30 Minutos
The Python Cheat Sheet for the Busy Marketer
Doing More with Less: Automated, High-Quality Content Generation
How to scale SEO work NOBODY wants to do (including your competitors) to rapi...
Agile SEO: Faster SEO Results
Scaling Keyword Research to Find Content Gaps
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Python for Data-driven Storytelling
Scaling automated quality text generation for enterprise sites
The New Renaissance of JavaScript
Data and Evidence-driven SEO
Python for SEO
Advanced Data-Driven SEO
Technical SEO "Overoptimization"
Why Pay for Performance When You Can Lead the World To Your Door for Free?

Recently uploaded (20)

PPTX
transformers as a tool for understanding advance algorithms in deep learning
PPTX
lung disease detection using transfer learning approach.pptx
PDF
Book Trusted Companions in Delhi – 24/7 Available Delhi Personal Meeting Ser...
PPTX
Stats annual compiled ipd opd ot br 2024
PPTX
Reinforcement learning in artificial intelligence and deep learning
PDF
General category merit rank list for neet pg
PPT
What is life? We never know the answer exactly
PPTX
DATA ANALYTICS COURSE IN PITAMPURA.pptx
PPTX
DIGITAL DESIGN AND.pptx hhhhhhhhhhhhhhhhh
PPTX
indiraparyavaranbhavan-240418134200-31d840b3.pptx
PPTX
Basic Statistical Analysis for experimental data.pptx
PPTX
C programming msc chemistry pankaj pandey
PDF
Nucleic-Acids_-Structure-Typ...-1.pdf 011
PPTX
ifsm.pptx, institutional food service management
PPTX
inbound2857676998455010149.pptxmmmmmmmmm
PDF
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
PPTX
Chapter security of computer_8_v8.1.pptx
PPTX
inbound6529290805104538764.pptxmmmmmmmmm
PDF
book-34714 (2).pdfhjkkljgfdssawtjiiiiiujj
PPT
Classification methods in data analytics.ppt
transformers as a tool for understanding advance algorithms in deep learning
lung disease detection using transfer learning approach.pptx
Book Trusted Companions in Delhi – 24/7 Available Delhi Personal Meeting Ser...
Stats annual compiled ipd opd ot br 2024
Reinforcement learning in artificial intelligence and deep learning
General category merit rank list for neet pg
What is life? We never know the answer exactly
DATA ANALYTICS COURSE IN PITAMPURA.pptx
DIGITAL DESIGN AND.pptx hhhhhhhhhhhhhhhhh
indiraparyavaranbhavan-240418134200-31d840b3.pptx
Basic Statistical Analysis for experimental data.pptx
C programming msc chemistry pankaj pandey
Nucleic-Acids_-Structure-Typ...-1.pdf 011
ifsm.pptx, institutional food service management
inbound2857676998455010149.pptxmmmmmmmmm
9 FinOps Tools That Simplify Cloud Cost Reporting.pdf
Chapter security of computer_8_v8.1.pptx
inbound6529290805104538764.pptxmmmmmmmmm
book-34714 (2).pdfhjkkljgfdssawtjiiiiiujj
Classification methods in data analytics.ppt

Query Classification on Steroids with BERT