How to turn your predictive models into APIs Using Domino

This blog post is about deploying analytical models (e.g., predictors, recommenders, classifiers) as REST APIs. I will explain why this is useful, and show you how to do this without a team of full-stack developers/engineers. All you need are the R/Python models you develop and a Domino Data Lab account.


More and more real-world systems are relying on data science and analytical models to deliver sophisticated functionality or improved user experiences. For example, Microsoft combined the power of advanced predictive models and web services to develop the real-time voice translation feature in Skype. Facebook and Google continuously improve their deep learning models for better face recognition features in their photo service.

Some have characterized this trend as a shift from Software-as-a-Service (SaaS) to an era of Models-as-a-Service (MaaS). These models are often written in statistical programming languages (e.g., R, Python), which are especially well suited to analytical tasks.

With analytical models playing an increasingly important role in real-world systems, and with more models being developed in R and Python, we need powerful ways of turning these models into APIs for others to consume.


Being a data scientist myself, there are things that I know I am good at and comfortable with like developing predictive models. However, hosting my models as a web service is certainly outside my comfort zone. Without the support of a full-stack technical team, I would have to spend months to set up my own MaaS.

For MaaS, Domino’™s API Endpoint feature allows users to deploy their R or Python models as web services in just a few clicks. It does not require any technical knowledge about REST API hosting at all. All you need is a working predictive model, and Domino handles all the infrastructure and plumbing to deploy your code as a production-grade web service. The following walk-through illustrates the process.

Quick-Start Example

Imagine we are developing a mobile application for scientists to use in the field: they take a picture of a flower, and our application needs to suggest its species. We can do some image processing on the mobile device, but our core classification code is written in R, which is ideal for a classification task like this. We need an easy way for our mobile app to use our €œflower classifier service€.

For this example, we’™ll use the classic Fisher’s Iris data. The dataset consists of 50 samples from each of three species of Iris (Iris setosa, Iris virginica, and Iris versicolor). Four features were measured from each sample (i.e., the length and the width of the sepals and petals). We will use this dataset to train a classifier in R, and then expose that classification model as an API.

Jo-fai (Joe) Chow Data Scientist at @VirginMedia and @DominoDataLab. Hydroinformatics EngD @STREAMstreamer. Wannabe Photographer. Blogger