The course is part of this learning path
Building a Recommendation Engine on Azure
Building a Recommendation Engine on Azure is a course designed for teams interested in using artificial intelligence to add product recommendations to their websites.
A product recommendation engine is a valuable feature that helps drive sales on e-commerce sites. In this course, you will learn the essentials of building, deploying, and testing a recommendation engine on Microsoft Azure. You will also build skills to fine-tune a recommendation model and evaluate its effectiveness.
This course is made up of five lectures covering deploying, testing, configuring, evaluating models, and making API requests. This is an intermediate level course, and prior Azure and API experience is recommended.
- Deploy a recommendation engine on Microsoft Azure
- Test and evaluate different recommendation models
- Make API calls to the Microsoft Product Recommendations Solution
- People who are interested in artificial intelligence services on Microsoft Azure, especially recommendation engines
- Experience using Microsoft Azure
- Experience using APIs
Related Training Content
The GitHub repository for this course is at https://github.com/cloudacademy/azure-recommendation-engine.
- [Instructor] When Amazon started giving its customers product recommendations on its website, other online vendors scrambled to catch up. Now it has become a common feature for ecommerce sites. The reason for its rapid adoption is obvious.
Relevant product recommendations drive higher sales. There are many products that can help you add recommendations to your website, but I'm going to show you how to use a solution that doesn't cost any more than the underlying Azure resources. It's Microsoft's Product Recommendation Solution. Here's how it works. Before it can give you product recommendations, you need to train it with some historical transaction data.
It goes through the data and looks for relationships between products by comparing the interests of different users. For example it looks for products that have been purchased together by many different users. Once you have a trained model you can add code to your website that requests recommendations by calling an API. You can get two types of recommendations. Item-to-item and personalized. For an item-to-item recommendation, you send an item number and it comes back with other items that a customer might want. This is so you can say something like, customers who bought this item also bought these items.
For a personalized recommendation, you send a list of recent transactions for a particular user and it comes back with product recommendations for that user. The algorithm it uses to come up with recommendations is actually quite straight forward. It uses what's called a collaborative filtering approach.
This just means that it combines the preferences of many people to come up with a recommendation for a given user. For item-to-item recommendations, it simply creates a matrix that shows how many times two particular items appear in the same transaction. For example item one and item three appeared in the same transaction four times. So if someone's looking at item one on your ecommerce website, then it'll look for the item that has been in the most transactions with item one, which is item three in this case, and say, customers who bought this item also bought item three.
The way it comes up with personalized recommendations is a bit more complicated, and it involves matrix multiplication, but it's still quite easy to understand. This is much different from any other machine learning approaches, such as deep neural networks, which can be very difficult to understand. Now let's look at the architecture of the system. The product recommendation solution deploys an app services web app.
This web app hosts the API that you call to train a model and also the API you call to get recommendations. It creates an Azure storage account for Blobs, Queues and a Table. It also creates a web job to perform the training operation. When you send a request to train a model, it gets the transaction data from Blob storage, adds an entry for that model in the model registry table, and adds a message to the train model queue.
When the web job sees the new entry in the train model queue it trains the model. When it's finished it puts the trained model in Blob storage and updates the entry in the model registry to say, completed. When you send a request to get recommendations, the process is much simpler.
It loads the trained model from Blob storage, runs the request through it, and returns the recommendations. Probably the most time-consuming part of getting the system up and running is to get your transaction data into the format that the training job expects.
Here's the schema. Each record needs to have a user id, an item id and the time when the event occurred. It can also have the event type. The choices are a click, that is the user clicked on a product, which has a weight of one. A recommendation click, meaning they clicked on a recommendation link. So this would only happen if you've already implemented a recommendation system of some sort. It has a weight of two.
Then there's add to shopping cart with weight of three. Remove from shopping cart with a weight of minus one, or purchase with a weight of four. These weights are used for personalized recommendations, where you give it a list of recent events for a particular user.
The algorithm takes into account the level of the user's interest in various products before making recommendations, which is why you need weights for the different actions. If the user purchased an item, then they're much more interested in it than if they just clicked on a link to see more about the item.
If you want to assign different weights to events, then you can add a custom event weight instead of an event type. Thankfully Microsoft has provided some sample data that's in the right format so we can just use that to try out the recommendation engine. I'll show you where it is in the next lesson. So if you're ready go to the next video.
About the Author
Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).