Deeper Dive into Azure Personalizer Service with Code

Deeper Dive into Azure Personalizer Service with Code

The next step in our journey through the Azure Personalizer Service will be looking at another use case through the lens of a developer. Our sample use case will leverage the Azure Portal as well as Python code to setup a Personalizer instance and create a personalizer model. Fortunately, the examples we have created will not require developer skillsets, but they should serve as real-world examples of how the service is implemented at the code level and capabilities of service from the Azure management portal.

Let's begin by deploying an instance of the Personalizer service in your Azure tenant.

Note: This part does require an Azure subscription with Cognitive Services enabled, consider signing up for a free trial of the service (https://azure.microsoft.com/en-us/free/free-account-faq/) if you don't have an account already.

Go to this repository: https://github.com/jakeatmsft/personalizer_api_lab

Click the "Deploy to Azure" button, to create the Personalizer Service.

No alt text provided for this image

This link will ask you to connect to Azure and create a deployment of the Azure Personalizer Service in that tenant.

No alt text provided for this image

Fill out the required fields, taking note of the "SKU" and "Cognitive Services Location" field. For our example, we will be using the F0 - Free Tier, and a location in West US 2.

Once your Personalizer service has been provisioned navigate to the Resource Group that was created, go to the Deployment section.

No alt text provided for this image
No alt text provided for this image

Retrieve the following Outputs for the next step, "cognitivekey1" and "endpoint".

To the Code...

To retrieve the code for interacting with the Personalizer service, we will be using Azure Notebooks, a free platform for running Python code in an interactive cloud environment. No need to install anything on your computer, everything is happening in your web browser.

Start by going to the Azure Notebooks project here: (https://notebooks.azure.com/jake-wang/projects/azpersonalizer-api-demo)

No alt text provided for this image

From here you can either copy the notebook into your own environment to run the code, or download the project to run in a local installation of Jupyter.

Open the "Personalizer.ipynb" notebook to get started. You should see the screen below.

No alt text provided for this image

Before running the notebook, go to the second "cell". Fill in the "personalization_base_url " with the "endpoint" and "resource_key" with the "cognitivekey1" value from the deployment outputs. You can run the notebook by clicking the ">| Run" button on each cell.

The scenario as described in the notebook, shows how the Personalizer service can be used to make Coffee recommendations from users, after running through the cells of the notebook, you will see how a working example of both the configuration and training of the learning policy as well as the evaluation of the results.


To view or add a comment, sign in

More articles by Jake Wang

Others also viewed

Explore content categories