Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Deploying your Predictive Models as a Service via Domino


Published on

This LondonR talk is about an easy way to “operationalise” your predictive models by exposing them as low-latency web services.

Published in: Technology

Deploying your Predictive Models as a Service via Domino

  1. 1. 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
  2. 2. Agenda • Background • My Domino Experience o Why o How • Examples (Iris & Stock Market) • Conclusions • Q & A 6/16/2015LondonR 2
  3. 3. I LondonR! 6/16/2015LondonR 3 All about my PhD project very interesting stuff …
  4. 4. First Collaboration 6/16/2015LondonR 4
  5. 5. Recap: what I really do 6/16/2015LondonR 5
  6. 6. Recap: what I really do 6/16/2015LondonR 6 Since last talk … xgboost(…), h2o.deeplearning(…)
  7. 7. About Domino Data Lab 6/16/2015LondonR 7
  8. 8. 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
  9. 9. 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
  10. 10. Web Interface 6/16/2015LondonR 10 Control Panel A List of Runs Console
  11. 11. Web Interface 6/16/2015LondonR 11 Resource Usage (I found it very useful!)
  12. 12. R Interface 6/16/2015LondonR 12
  13. 13. R Interface 6/16/2015LondonR 13
  14. 14. “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
  15. 15. Predictive Model? 6/16/2015LondonR 15 y = f( X1, X2, X3, X4)
  16. 16. Upload and Run 6/16/2015 16 Upload the R script to Domino (Web / R) Start the Run (Web / R)
  17. 17. 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
  18. 18. 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.
  19. 19. 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
  20. 20. How to use the API? 6/16/2015LondonR 20
  21. 21. 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
  22. 22. 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
  23. 23. 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
  24. 24. 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
  25. 25. Results Notification 6/16/2015LondonR 25 Summary PDF
  26. 26. Automatic Version Control 6/16/2015LondonR 26 Latest Version One of the Previous Versions (I was experimenting with ggplot2)
  27. 27. Stock API Endpoint 6/16/2015LondonR 27 Stock Symbol (Ticker) for Query
  28. 28. Code Sharing 6/16/2015LondonR 28 Control Panel  Settings  One Click
  29. 29. Try it Yourself 6/16/2015LondonR 29 Register at Help, Quick Start, Forum at
  30. 30. Try it Yourself 6/16/2015LondonR 30 Go to
  31. 31. Set up your first API Endpoint in Minutes 6/16/2015LondonR 31 Point it to your own project Insert your own API key
  32. 32. 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
  33. 33. Thanks! • Mango Solutions • My Colleagues at Domino • More Info and Feedback o o Twitter: @matlabulous o • Code o Iris Example – o Stock Example – 6/16/2015LondonR 33