Tutorial of Azure Personalizer

Kristjan Eljand
4 min readNov 7, 2019

This tutorial gives you step-by-step introduction of how to get started with Azure Personalizer. This tutorial has been updated on 07.11.2019. Please remember that the service is under active development and might not match this tutorial in the future.

1. Prerequisites

1.1. Create an account in Microsoft Azure Cloud Platform

To start, you need an Azure subscription. An Azure subscription allows you to manage storage, compute, and other assets in the Azure cloud. You can create a new subscription or access existing subscription information from the Azure portal. Alternatively, ask IT admin or your manager to create a subscription for you.

1.2. Create a Resource

Azure platform has a concept of resources which means a specific service. In order to create a Personalizer resource, log in to your Azure Cloud account -> search for “Personalizer” and click on the result:

The form that opens asks for the following information:

  • Name: Give a name to your service and remember it;
  • Subscription: This should be prefilled for you;
  • Location: choose the closest Location to you (this is where the servers will be located);
  • Resource group: Ask from IT admin or your manager what would be the correct resource group or enter a name to create a new resource group (A resource group holds related resources for an Azure solution).
  • Pricing tier — select F0 for free tier;
  • Click ”Create”.

If everything goes as expected, you should see that deployment succeeded. Search your freshly created resource by its name and click on it:

2. Tuning the settings of the personalizer

In the resource management page, select “settings”. Change the “Model update frequency” to 30 seconds. This will train the service rapidly, allowing you to see how model gets better with every iteration.

If you select “Model and Policy” under the Resource management, you’ll see that the model has already been created and now you just need to start using it. Well, easier said than done.

3. Training the personalizer

This is where things get complicated with Azure personalizer because you need to start coding. I’ll try to go through the initial example step-by-step. So, even if you haven’t coded before, you are probably able to make your first API calls 😊.

First, open the Quick start page and click on documentation:

Among other things, documentation also includes “Samples” and “REST API Reference” — open these pages in separate tabs:

3.1. Setting up the notebook

Download the samples repository from the page you just opened and unzip it. Alternatively, you can clone the repo:

Open the Jupyter notebook environment of your choice. I currently created a new Notebook VM in Azure Machine Learning Service and carry out the test in JupyterLab environment:

If you use the similar web-based notebook environment, you first need to upload the notebook sample. Don’t upload the whole repository. In the unzipped samples folder, locate samples -> azurenotebook and upload the contents of this folder. You should see 4 files in your working directory:

The heavy lifting is almost done. Open the Personalization.ipynb and replace the “personalization_base_url” and “subscription_key” with the Key and Endpoint you’ll find in the Quick start page of your personalizer (in Azure environment):

You can now run the whole notebook cell-by-cell but I would also recommend to make the following change: scroll down and insert “1000” into the two highlighted spots — this ensures that every iteration includes 1000 calls to API and the system waits for 310 seconds before the next iteration. The lag-time ensures that the model would be retrained before the next iteration.

That’s it for the main workflow. Of course, there is lot more to be learned about tuning the training policy and evaluating the models, but it is out of scope of this tutorial. Have fun!

--

--