Building a Recommendation Engine on Azure
The course is part of this learning path
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] Now it's time to deploy the recommendation solution and try it out. Go to the GitHub repository for this course. The link is at the bottom of the overview below. Then click on the link to the Product Recommendation Solution. This takes you to another GitHub repository. You should see a Deploy to Azure button, click on it. It should open up the Azure portal. You can use an existing resource group if you want.
I'm going to create a new one called Recommend. For the Account Type, you can leave it at locally redundant storage. For the Hosting Plan Skew, since this is just a test environment let's change it to B1 which is the cheapest one.
You can leave the App Insights Location with whatever it defaults to, assuming it's reasonably close to where you're located. Then check the terms and conditions box and click the purchase button. It'll take a little while to deploy so I'll fast forward. When it's done go to the Resource Group. Then click Deployments in the Settings menu. Click on Microsoft.template. These are the resource that was deployed by the solution.
There are several different ways to try out the Recommendation engine. One way is to use the sample code in Microsoft's GitHub repository for this solution. It takes care of uploading the sample data files and it also makes the API calls to train the model and get recommendations.
You can try it out if you want but I'm going to use a different method. I'm going to take you through the process manually so you can see all of the steps involved. The first step is to upload the sample data to Azure storage. Go back to the GitHub repository for this course, and click on the sample data.zip file. Then click download. Unzip the file. Let's have a look at demousage.csv which is the one that contains the transactions.
Each record has a user id, an item id, and a time stamp. So this matches the schema I showed you earlier. Now go back to the Azure portal. If you look in the Type field you'll see that it created a storage account. Click on that. And then go into Blobs. Click the add container button. Call it sample-data. Then go into the container, and click upload. Select demousage.csv. Now upload the other two files. Okay, go back to the template overview.
Now click on outputs. The solution comes with a UI we can use to interact with it. Click the copy button next to the URL for the recommendations UI. Then paste it in a new browser tab. It asks you for the Admin API Key. Go back to the portal and copy the Admin Primary Key. Then paste it here. Alright, it's finally time to train the model. There are lots of fields here but don't worry. We only need to fill in two of them.
The container name of the blob we put the data in is called sample-data. I've already done this before which is why it's showing up in my browser already. But I'll type it again anyway. In the next field type demousage.csv. Now click the train button. It shouldn't take very long to finish but I'll still fast forward. There. The status is completed. Now that you have a trained model you can click on the score button to get recommendations.
This top section is for item-to-item recommendations. All you have to do is enter one or more item id's and the number of recommendations you want to get back. Go back to the demousage.csv file and copy one of the item id's. Or if you don't still have the file open, just type dqf-00248. It already put 10 in the number of recommendations field. That's fine, click the get recommendations button. It came back very quickly.
Here's the list of recommended items. Each one has a score and they're sorted from highest to lowest. So the top item, daf 349, is the one it thinks will be the most interesting for people who are looking at item dqf 248. Trying out personalized recommendations is going to take a bit more work. We have to give it a list of recent transactions for a user and we need to do that in JSON format. It would require a lot of typing, so I included a sample in the readme file for this course.
You can copy it from here. This is just two transactions. Each one has an item id, an event type, which is purchased in this case. And the date and time when the transaction occurred. Even with only two transactions, this gives the algorithm a lot more to work with because now it knows two items that this user liked so much that they bought them.
Click get recommendations. The output looks similar to the last one but notice that the scores are higher. In other words the algorithm has more confidence that the user will like these items, than it did for the item-to-item recommendations before. In the next lesson, I'll show you how you can fine-tune the engine.
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).