Intelligent apps are emerging as the next frontier in analytics and application development. Learn how to build intelligent apps on MongoDB powered by Google Cloud with TensorFlow for machine learning and DialogFlow for artificial intelligence. Get your developers and data scientists to finally work together to build applications that understand your customer, automate their tasks, and provide knowledge and decision support.
3. Analytics is a Constant Underachiever
2000
Business Intelligence
Data Warehouse, OLAP, Ad-
hoc, Reporting, Dashboards
Big Data
Hadoop, MapReduce,
Predictive, ML, Real-time
2010
AI
Intelligent Things, IoT,
Systems of Engagement
2017
“In 2018, 75% of AI projects will underwhelm because they fail to model operational
considerations, causing business leaders to reset the scope of AI investments.”
FORRESTER.COM/PREDICTIONS
4. $40B+ eCommerce platform
experience of millions of mobile
gamers
metadata for every single item
for sale on eBay.com
world’s leading design
collaboration platform
20M+ users
$150B+ traded
reinvent travel for millions of
customers
lab and clinical analysis for
innovative medicines
personal and business finance
management worldwide
Applications Change Our World
5. Operational
AI
ML
What We Set Out To Do
shop for
products
online
Intelligent App
get
personalized
product
recommendatio
ns
shop over
MMS/Whats
App on
mobile
device
ML
6. What’s an Intelligent App?
Applications are increasingly combining real-time analytics, machine learning
and AI to provide understand the customer, automate their tasks and provide
knowledge and decision support
7. Why Is This Hard?
Intelligent App
Developer
s
Data Scientists
uses: live data
guided by: user stories
produces: functionality
uses: prepared data
guided by: question
produces: insight
RELEASE DEFINE
BUILD
AGILE
DATA
PREP
BUILD
MODEL
GET
INSIGHT
VIZ
DEPLOY
TRAIN/EVAL
9. eCommerce App: SwagStore
Get notified when a
sold-out item is
restocked
Browse for your favorite
MongoDB swag
Put items in cart and
checkout
View your orders
10. Stitch: MongoDB Serverless Platform
Streamlines app development with
simple, secure access to data and
services from the client with
thousands of lines less code to write
and no infrastructure to manage.
Getting your apps to market faster
while reducing operational costs.
11. SwagStore: How We Built It
UI components
Routes
Application Flow Control
Google Authentication
Twilio Notifications
Functions
Rules
Triggers
Service Integrations
Flexible Document Model
Easy to Work With Data
14. Intelligent eCommerce App: SwagStore +
Receive personalized
product
recommendations based
on ML algorithm
Recommendation
Engine
15. Intelligent SwagStore: How We Built It
SwagStore
Google Cloud ML
trains and tunes model using
TensorFlow WALS Algorithm
Google Cloud Endpoints
serve recommendations
Stitch initiates
recommendations
developer data scientist developer
data engineer
16. Production Recommendation Solution on
GCP
Google Analytics
BigQuery
Google Analytics
360
Customer Web
Application
Web
Server
Application
Server
Database
Server
Rec API
App Engine
Cloud
Endpoints
Model Training
Cloud Machine Learning
Orchestration
Cloud Composer
ML Data
Training
Model files
Browser
Client
Mobile /
Tablet Client
17. The Recommendation API
Google Analytics
BigQuery
Rec API
App Engine
Cloud
Endpoints
Model Training
Cloud Machine Learning
ML Data
Training
Model files
UserID
User factor x
Item factors
Item ID &
User ID
Maps
Sort & Filter
Article
Index
List
Item ID &
User ID
Maps
Article
ID
List
ML Model
18. Training Recommendation Model
1. install the model code
2. place data into your Cloud Storage Bucket
3. run training script
When the training is finished, the model data is saved in a subdirectory named model under
the job directory of the training task. This data consists of several arrays, all saved in numpy
format
./mltrain.sh train
gs://recserve_jfmlrecengine/swag_pageviews.cs
v --data-type web_views
19. Tuning Recommendation Model
Hyperparameter tuning optimizes your machine learning model for most accuracy
Typically data scientists experimenting with various values, test the model, and then pick a combination
of parameters with the best performance.
But you can test every possible combination of parameters…. it would take a very very long time
● Each hyperparameter is passed to
the hyperparameter tuning job on
Cloud ML Engine.
● The model writes a TensorFlow
summary with a special tag that's set
to the metric that evaluates the
quality of the model.
● This summary metric enables the
search process of the Cloud ML
Engine hyperparameter tuning
./mltrain.sh tune
gs://recserve_jfmlrecengine/
swag_pageviews.csv --data-
type web_views
20. AI does AI
Systematic exploration
of the model space, using
the techniques finessed in
AlphaGo, yields super-human
performance in AI network design
21. Generate Recommendations
model.py : generate_recommendations
input
user: row index of the user in the rating matrix
items: list of indexes for items that the user has rated / viewed
latent factors: row and column factors generated by training / tuning the
model
number of desired recommendations
https://jfmlrecengine.appspot.com/recommendation?us
erId=5448543647176335931&numRecs=6
{"articles":
["299824032
","29993528
7","2998657
57","299959
410","29815
7062","2998
16215"]}
22. Serving Recommendations with Stitch
MongoDB Stitch send a HTTP GET
request to Google Cloud Endpoint
to obtain recommendations
For user who is logged in
Get list of product
recommendations
Update user profile with that
list
Service Integrations make it
simple for your app to use
leading third party services
Functions: build complex logic and orchestrate data
between clients, and services
Stitch scales precisely to meet your usage.
26. Intelligent SwagStore: How We Built It
SwagStore
Google DialogFlow:
Intent, Entities, Webhooks
Stitch - Intent Fulfilment Slack - Front End
developer
data scientist
developer data engineer
27. DialogFlow + Stitch Architecture
Stitch HTTP
Service
Webhook
Stitch Functions to
retrieve products
from MongoDB
28. Me: “Can you help me find a jacket?”
ChatBot: “What color would you like?”
Me: “White, please”
ChatBot: “I found you a white Egmont Jacket”
DialogFlow: Rich and Natural
Conversational Experiences
Stitch Service
Integration
30. Enabling DialogFlow Fulfillment With Stitch
return item from SwagStore Catalog to
DialogFlow
{
"fulfillmentText": "I found you a white
Egmont Packable Jacket. Check it out
here: https://mdb-swag-
store.netlify.com/products/299824032"
}
perform $find given
parameters requested
by DialogFlow: product
type and product color