Real-time scoring with Microsoft R Server 9.1

May 4, 2017

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Once you've built a predictive model, in many cases the next step is to operationalize the model: that is, generate predictions from the pre-trained model in real time. In this scenario, latency becomes the critical metric: new data typically become available a single row at a time, and it's important to respond with that single prediction (or score) as quickly as possible.

Consider the example of presenting your credit card for payment at a store: the bank has to evaluate that transaction as being fraudulent or not, and return that signal to the store while you wait for the credit card machine to respond. In order to minimize your waiting time, and considering that thousands of transactions may be processed each second, a response must be generated in milliseconds.

Now, with Microsoft R Server 9.1, you can operationalize certain models trained using the RevoScaleR and MicrosoftML packages as real-time web services. These web services use the R objects you create when you train the model, but don't themselves rely on an R interpreter. This means the latency of the service is very low, and can respond in a matter of milliseconds.


To publish a model as a web service, you'll need an instance of Microsoft R Server for Windows or SQL Server 2017 Machine Learning Services to act as the host. Once you've used the publishService function (with the serviceType=RealTime option) to operationalize your model, you can generate scores from any application on any remote platform using the Swagger RESTful API service it creates. The model types supported include the rxLogit, rxLinMod, rxBTrees, rxDTree, and rxDForest functions (from the RevolScaleR package), and rxFastTrees, rxFastForest, rxLogisticRegression, rxOneClassSvm, rxNeuralNet, rxFastLinear, featurizeText, featurizeImage, and getSentiment (from the MicrosoftML package).  You can see a complete example here.

For more on operationalizing models in R Server 9.1, check out the blog post linked below.

Microsoft R Blog: What’s new in R Server 9.1 Operationalization

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)