Over a million developers have joined DZone.

Recommendation Systems in Azure

DZone's Guide to

Recommendation Systems in Azure

The Recommendations API is one of the pre-configured machine learning services that Azure provides out-of-the-box. Come learn how it works and look at a sample project!

· AI Zone ·
Free Resource

Did you know that 50- 80% of your enterprise business processes can be automated with AssistEdge?  Identify processes, deploy bots and scale effortlessly with AssistEdge.

Azure provides a number of pre-configured machine learning services out-of-the-box. One of these (still in beta at the time of writing this) is recommendations — the idea being that it will try to work out what, given a list of items, you would prefer, based knowledge about your habits. There's a lot of information online about this, but briefly, it can work out what your preference is based a combination of your past activity and the past activity of others that have shown an interest in the same item.

Obviously, the "items" could be products, films, aardvarks, or sheep; Azure doesn't know anything about the content of what it's recommending. If you've bought* "A" in the past, and 75% of everyone else that has bought "A" has also bought "B," then there's a chance you'll want "B." "A" could be an apple, and "B" could be a pair of sunglasses; so obviously, you need to be careful about the data that you feed it.

Recommendations API

The first thing to note is that the Recommendations API represents an earlier attempt to implement this by Microsoft, and is due to be discontinued early next year (2018). If you try to use this to follow any of the online tutorials, then you'll get into a world of hurt.

Deploy Recommendations

The new method of creating a recommendations service is via a wizard (which, I believe, behind the scenes, builds a custom ARM template). This is the start of the deployment, and gives you a screen similar to the following (once you've logged in):

Image title

As you can see, there's clearly some re-branding in progress here; anyway, complete the form and create the service.

Image title

Another thing that has changed in the new version of this is that the free pricing tier has disappeared:

Image title

After a few screens, it starts the deployment process:

Image title

The next screen that is displayed shows all the connection strings and keys in one handy reference:

Image title

...they are just below this screenshot.

This should create four separate services:

Image title

Sample Project

Microsoft provides a sample project that should work out of the box (they actually provide more than one — some of which work better than others). This one uses AutoRest, but there's another referenced at the bottom of this post.

In this project, open Recommendations.Sample.Program.cs and, at the top of the main function, enter the details that you noted after the creation of your service. If you didn't note them, then you can still find them. You'll notice that four separate services were created: AppService, StorageAccount, App Insights, and an App Service Plan.


Is found in the URL of the App Service:

Image title


Is found in the Application Settings of the App Service:

Image title


Is the connection string of the storage account:

Image title

If you run this now, you should find that it will process and score the recommendations:

Image title

So, for example, we can see from the results above that people who bought DHF-01159 are recommended to buy DHF-01055 (although it doesn't seem very convinced).

Note: The term that Azure uses here is "purchase." Different actions have different weighting (configurable), but by default, you would assume that buying something is more important than, for example, clicking on it ("click" is another action). These actions can mean anything you choose; in the sheep example above, "purchase" might mean shearing, and "click" might mean photographing.

Recommended Reading

Consuming AI in byte sized applications is the best way to transform digitally. #BuiltOnAI, EdgeVerve’s business application, provides you with everything you need to plug & play AI into your enterprise.  Learn more.

ai ,machine learning ,recommendation system ,tutorial ,api

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}