Skip Navigation

Real example: improve accuracy, reduce training times for existing R codebase

Posted on August 2, 2018

Software Architect, Microsoft Azure

When you buy an item on a favored website, does the site show you pictures of what others have bought? That’s the result of a recommendation system. Retailers have been building such systems for years, many built using the programming language R. For older implementations of recommender systems, it’s time to consider improving performance and scalability by moving these systems to the cloud —the Azure cloud.


Problem: to re-host and optimize an existing R model in Azure

Recently, we were asked to help a customer improve the performance and process surrounding the R implementation of their recommender solution and host the model in Azure. Many of their early analytic products were built in R, and they wanted to preserve that investment. After a review of their solution, we identified bottlenecks that could be vanquished. We worked together to find a way to significantly improve the model training time using parallel R algorithms. Then we worked to streamline how they operationalized their R model. All the work was done using libraries available with Microsoft Machine Learning Server (R Server). 

The architecture: Azure SQL + Machine Learning Server

There are several components and steps to the solution. We needed a database for hosting the training data and used Azure SQL.  We also needed a mechanism to expose the R model as a REST endpoint and used Microsoft Machine Learning Server (MLS) in Azure to host the parallel R algorithms but with a twist: MLS is installed on virtual machines in Azure. One is dedicated to model training (DEV); the second hosts the model in production (OPS). The separation allows for different machine optimizations. The DEV server is configured for compute-intensive workloads (more memory, optimized chipset); the OPS server is smaller and optimized for responding to web service calls.

Recommended next steps

Read Optimize and reuse an existing recommendation system to learn details on the architecture of the solution, and get explanations to help you implement your own version. We hope you find this helpful and we welcome your feedback.