Deploying your Predictive
Models as a Service via
Domino API Endpoint
Jo-fai (Joe) Chow
Data Scientist at Domino Data Lab
6/16/2015 1LondonR
Agenda
• Background
• My Domino Experience
o Why
o How
• Examples (Iris & Stock Market)
• Conclusions
• Q & A
6/16/2015LondonR 2
I LondonR!
6/16/2015LondonR 3
All about my PhD project
very interesting stuff …
First Collaboration
6/16/2015LondonR 4
http://blog.dominoup.com/using-r-h2o-and-domino-for-a-kaggle-competition/
Recap: what I really do
6/16/2015LondonR 5
Recap: what I really do
6/16/2015LondonR 6
Since last talk …
xgboost(…),
h2o.deeplearning(…)
About Domino Data Lab
6/16/2015LondonR 7
Why I use Domino
• Data science is complicated.
o Knowing how to fit a model is not enough!
o Variety of challenges from data analysis to production.
o There is no one-size-fits-all solution.
• I do not have time/skills for every single task.
• I can use Domino to fill the gaps.
• Focus on understanding problems, improving
models and presenting results.
• Speed up analysis in just a few clicks.
• More time for family and other stuff.
6/16/2015LondonR 8
How I use Domino
• Interface
o Web or R
• Examples
o Hello, World! (Iris)
o Stock Market Forecast
• Code Sharing
• Try it Yourself
6/16/2015LondonR 9
Web Interface
6/16/2015LondonR 10
Control Panel
A List of Runs
Console
Web Interface
6/16/2015LondonR 11
Resource Usage (I found it very useful!)
R Interface
6/16/2015LondonR 12
R Interface
6/16/2015LondonR 13
“Hello, World!” Example
• Classic dataset - Iris
• Four numeric features / predictors (x)
o Sepal Length, Sepal Width, Petal Length and Petal Width
• One categorical target (y)
o Three species of Iris – Setosa, Versicolor and Virginica
• Using R to build a simple predictive model
• Saving the model for future use
• Deploying the model as web service
• Automatic version control
6/16/2015LondonR 14
Predictive Model?
6/16/2015LondonR 15
y = f( X1, X2, X3, X4)
Upload and Run
6/16/2015https://app.dominoup.com/jofaichow/example_iris 16
Upload the R script to
Domino (Web / R)
Start the Run
(Web / R)
Evaluate and Save
6/16/2015LondonR 17
Print “Random Forest”
model summary
Model with highest
10-fold cross-
validation accuracy
(i.e. best parameter
setting)
Include statistics for
future comparison
Finally, save the model
for future use
Deploy
6/16/2015LondonR 18
Model
This script 1) loads the model, 2) takes four numeric inputs
(X1, X2, X3 & X4) and then 3) returns a prediction.
Deploy
6/16/2015LondonR 19
Point to that script
Specify the function to call
Publish or unpublish the API
Domino automatically keeps all versions of your API
How to use the API?
6/16/2015LondonR 20
Python API Example
6/16/2015LondonR 21
X1, X2, X3 and X4
The four Iris features:
Sepal Length, Sepal Width,
Petal Length and Petal Width
Stock Market Forecast
• Historical stock data from Yahoo!
• Using R to generate numeric features (x)
• Target (y) – Next Trading Day % Change in Closing
Price
• Using R to build ensembles for forecast
• Configure scheduled runs
• Automatic version control
• API
6/16/2015LondonR 22
Predictive Model
6/16/2015LondonR 23
Historical stock price
data from Yahoo!
x: Multiple Technical Analysis Indicators
y: Next Day % Change in Closing Price
Predictive Model:
Ensemble of xgboost models
For more info, see
app.dominoup.com/jofaichow/example_stock
Scheduled Runs
6/16/2015LondonR 24
Point to the R script
Schedule to run at a certain time every
Weekday (more options available)
Re-publish API endpoint so it uses the latest results
Select different hardware tiers
Notify your friends / colleagues / clients
Results Notification
6/16/2015LondonR 25
Summary PDF
Automatic Version
Control
6/16/2015LondonR 26
Latest Version One of the Previous Versions
(I was experimenting with ggplot2)
Stock API Endpoint
6/16/2015LondonR 27
Stock Symbol (Ticker) for Query
Code Sharing
6/16/2015LondonR 28
Control Panel  Settings  One Click
Try it Yourself
6/16/2015LondonR 29
Register at www.dominodatalab.com
Help, Quick Start, Forum at support.dominodatalab.com
Try it Yourself
6/16/2015LondonR 30
Go to https://app.dominoup.com/jofaichow/example_iris
Set up your first API
Endpoint in Minutes
6/16/2015LondonR 31
Point it to your own project
Insert your own API key
Conclusions
• Data science is complicated.
• Our time is important.
• I can use Domino to save time.
• It helps me to tackle some challenges
that are outside my comfort zone.
6/16/2015LondonR 32
Thanks!
• Mango Solutions
• My Colleagues at Domino
• More Info and Feedback
o jofai@dominoup.com
o Twitter: @matlabulous
o http://blog.dominodatalab.com/
• Code
o Iris Example –
https://app.dominoup.com/jofaichow/example_iris
o Stock Example –
https://app.dominoup.com/jofaichow/example_stock
6/16/2015LondonR 33

Deploying your Predictive Models as a Service via Domino