Real-time scoring with Microsoft R Server 9.1
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.