Skip to content

Commit fcc37d1

Browse files
committed
fix rank and reward language
1 parent 37b5ade commit fcc37d1

File tree

6 files changed

+99
-110
lines changed

6 files changed

+99
-110
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: cognitive-services
5+
author: diberry
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: personalizer
9+
ms.topic: include
10+
ms.custom: include file
11+
ms.date: 01/15/2020
12+
ms.author: diberry
13+
---
14+
## Change the model update frequency
15+
16+
In the Azure portal, in the Personalizer resource on the **Configuration** page, change the **Model update frequency** to 10 seconds. This short duration will train the service rapidly, allowing you to see how the top action changes for each iteration.
17+
18+
![Change model update frequency](../media/settings/configure-model-update-frequency-settings.png)
19+
20+
When a Personalizer loop is first instantiated, there is no model since there has been no Reward API calls to train from. Rank calls will return equal probabilities for each item. Your application should still always rank content using the output of RewardActionId.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: cognitive-services
5+
author: diberry
6+
manager: nitinme
7+
ms.service: cognitive-services
8+
ms.subservice: personalizer
9+
ms.topic: include
10+
ms.custom: include file
11+
ms.date: 01/15/2020
12+
ms.author: diberry
13+
---
14+
## Create a Personalizer Azure resource
15+
16+
Create a resource for Personalizer using the [Azure portal](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) or [Azure CLI](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli) on your local machine. You can also:
17+
18+
* Get a [trial key](https://azure.microsoft.com/try/cognitive-services) valid for 7 days for free. After signing up, it will be available on the [Azure website](https://azure.microsoft.com/try/cognitive-services/my-apis/).
19+
* View your resource on the [Azure portal](https://portal.azure.com/).
20+
21+
After you get a key from your trial subscription or resource, create two [environment variable](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication):
22+
23+
* `PERSONALIZER_RESOURCE_KEY` for the resource key.
24+
* `PERSONALIZER_RESOURCE_ENDPOINT` for the resource endpoint.
25+
26+
In the Azure portal, both the key and endpoint values are available from the **quickstart** page.

articles/cognitive-services/personalizer/includes/quickstart-sdk-csharp.md

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,14 @@ ms.author: diberry
2323
There are several steps to use this quickstart:
2424

2525
* In the Azure portal, create a Personalizer resource
26-
* In the Azure portal, for the Personalizer resource, on the **Configuration** page, change the model update frequency
26+
* In the Azure portal, for the Personalizer resource, on the **Configuration** page, change the model update frequency to a very short interval
2727
* In a code editor, create a code file and edit the code file
2828
* In the command line or terminal, install the SDK from the command line
2929
* In the command line or terminal, run the code file
3030

31-
## Create a Personalizer Azure resource
31+
[!INCLUDE [Create Azure resource for Personalizer](create-personalizer-resource.md)]
3232

33-
Create a resource for Personalizer using the [Azure portal](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) or [Azure CLI](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli) on your local machine. You can also:
34-
35-
* Get a [trial key](https://azure.microsoft.com/try/cognitive-services) valid for 7 days for free. After signing up, it will be available on the [Azure website](https://azure.microsoft.com/try/cognitive-services/my-apis/).
36-
* View your resource on the [Azure portal](https://portal.azure.com/).
37-
38-
After you get a key from your trial subscription or resource, create two [environment variable](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication):
39-
40-
* `PERSONALIZER_RESOURCE_KEY` for the resource key.
41-
* `PERSONALIZER_RESOURCE_ENDPOINT` for the resource endpoint.
42-
43-
In the Azure portal, both the key and endpoint values are available from the **quickstart** page.
44-
45-
## Change the model update frequency
46-
47-
In the Azure portal, in the Personalizer resource on the **Configuration** page, change the **Model update frequency** to 10 seconds. This short duration will train the service rapidly, allowing you to see how the top action changes for each iteration.
48-
49-
![Change model update frequency](../media/settings/configure-model-update-frequency-settings.png)
50-
51-
When a Personalizer loop is first instantiated, there is no model since there has been no Reward API calls to train from. Rank calls will return equal probabilities for each item. Your application should still always rank content using the output of RewardActionId.
33+
[!INCLUDE [!Change model frequency](change-model-frequency.md)]
5234

5335
## Create a new C# application
5436

@@ -90,19 +72,19 @@ If you're using the Visual Studio IDE, the client library is available as a down
9072

9173
The Personalizer client is a [PersonalizerClient](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.personalizerclient?view=azure-dotnet) object that authenticates to Azure using Microsoft.Rest.ServiceClientCredentials, which contains your key.
9274

93-
To ask for a rank of the content, create a [RankRequest](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.models.rankrequest?view=azure-dotnet-preview), then pass it to [client.Rank](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.personalizerclientextensions.rank?view=azure-dotnet-preview) method. The Rank method returns a RankResponse, containing the ranked content.
75+
To ask for the single best item of the content, create a [RankRequest](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.models.rankrequest?view=azure-dotnet-preview), then pass it to [client.Rank](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.personalizerclientextensions.rank?view=azure-dotnet-preview) method. The Rank method returns a RankResponse.
9476

95-
To send a reward to Personalizer, create a [RewardRequest](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.models.rewardrequest?view=azure-dotnet-preview), then pass it to the [client.Reward](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.personalizerclientextensions.reward?view=azure-dotnet-preview) method.
77+
To send a reward score to Personalizer, create a [RewardRequest](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.models.rewardrequest?view=azure-dotnet-preview), then pass it to the [client.Reward](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.personalizer.personalizerclientextensions.reward?view=azure-dotnet-preview) method.
9678

97-
Determining the reward, in this quickstart is trivial. In a production system, the determination of what impacts the [reward score](../concept-rewards.md) and by how much can be a complex process, that you may decide to change over time. This design decision should be one of the primary decisions in your Personalizer architecture.
79+
Determining the reward score, in this quickstart is trivial. In a production system, the determination of what impacts the [reward score](../concept-rewards.md) and by how much can be a complex process, that you may decide to change over time. This design decision should be one of the primary decisions in your Personalizer architecture.
9880

9981
## Code examples
10082

10183
These code snippets show you how to do the following tasks with the Personalizer client library for .NET:
10284

10385
* [Create a Personalizer client](#create-a-personalizer-client)
104-
* [Request a rank](#request-a-rank)
105-
* [Send a reward](#send-a-reward)
86+
* [Rank API](#request-the-best-action)
87+
* [Reward API](#send-a-reward)
10688

10789
## Add the dependencies
10890

@@ -124,13 +106,13 @@ Next, create a method to return a Personalizer client. The parameter to the meth
124106

125107
## Get food items as rankable actions
126108

127-
Actions represent the content choices you want Personalizer to rank. Add the following methods to the Program class to represent the set of actions to rank.
109+
Actions represent the content choices from which you want Personalizer to select the best content item. Add the following methods to the Program class to represent the set of actions and their features.
128110

129111
[!code-csharp[Food items as actions](~/samples-personalizer/quickstarts/csharp/PersonalizerExample/Program.cs?name=createAction)]
130112

131113
## Get user preferences for context
132114

133-
Add the following methods to the Program class to get a user's input from the command line for the time of day and current food preference. These will be uses as context when ranking the actions.
115+
Add the following methods to the Program class to get a user's input from the command line for the time of day and current food preference. These will be used as context features.
134116

135117
[!code-csharp[Present time out day preference to the user](~/samples-personalizer/quickstarts/csharp/PersonalizerExample/Program.cs?name=createUserFeatureTimeOfDay)]
136118

@@ -142,9 +124,9 @@ Both methods use the `GetKey` method to read the user's selection from the comma
142124

143125
## Create the learning loop
144126

145-
The Personalizer learning loop is a cycle of rank and reward calls. In this quickstart, each rank call, to personalize the content, is followed by a reward call to tell Personalizer how well the service ranked the content.
127+
The Personalizer learning loop is a cycle of [Rank](#request-the-best-action) and [Reward](#send-a-reward) calls. In this quickstart, each Rank call, to personalize the content, is followed by a Reward call to tell Personalizer how well the service performed.
146128

147-
The following code in the `main` method of the program loops through a cycle of asking the user their preferences at the command line, sending that information to Personalizer to rank, presenting the ranked selection to the customer to choose from among the list, then sending a reward to Personalizer signaling how well the service did in ranking the selection.
129+
The following code loops through a cycle of asking the user their preferences at the command line, sending that information to Personalizer to select the best action, presenting the selection to the customer to choose from among the list, then sending a reward score to Personalizer signaling how well the service did in its selection.
148130

149131
[!code-csharp[Learning loop](~/samples-personalizer/quickstarts/csharp/PersonalizerExample/Program.cs?name=mainLoop)]
150132

@@ -155,19 +137,19 @@ Add the following methods, which [get the content choices](#get-food-items-as-ra
155137
* `GetUsersTastePreference`
156138
* `GetKey`
157139

158-
## Request a rank
140+
## Request the best action
159141

160-
To complete the rank request, the program asks the user's preferences to create a `currentContent` of the content choices. The process can create content to exclude from the rank, shown as `excludeActions`. The rank request needs the actions, currentContext, excludeActions, and a unique rank event ID (as a GUID), to receive the ranked response.
142+
To complete the Rank request, the program asks the user's preferences to create a `currentContent` of the content choices. The process can create content to exclude from the actions, shown as `excludeActions`. The Rank request needs the actions and their features, currentContext features, excludeActions, and a unique event ID, to receive the response.
161143

162144
This quickstart has simple context features of time of day and user food preference. In production systems, determining and [evaluating](../concept-feature-evaluation.md) [actions and features](../concepts-features.md) can be a non-trivial matter.
163145

164146
[!code-csharp[The Personalizer learning loop ranks the request.](~/samples-personalizer/quickstarts/csharp/PersonalizerExample/Program.cs?name=rank)]
165147

166148
## Send a reward
167149

168-
To complete the reward request, the program gets the user's selection from the command line, assigns a numeric value to each selection, then sends the unique rank event ID and the numeric value to the reward method.
150+
To get the reward score to send in the Reward request, the program gets the user's selection from the command line, assigns a numeric value to the selection, then sends the unique event ID and the reward score as the numeric value to the Reward API.
169151

170-
This quickstart assigns a simple number as a reward, either a zero or a 1. In production systems, determining when and what to send to the [reward](../concept-rewards.md) call can be a non-trivial matter, depending on your specific needs.
152+
This quickstart assigns a simple number as a reward score, either a zero or a 1. In production systems, determining when and what to send to the [Reward](../concept-rewards.md) call can be a non-trivial matter, depending on your specific needs.
171153

172154
[!code-csharp[The Personalizer learning loop ranks the request.](~/samples-personalizer/quickstarts/csharp/PersonalizerExample/Program.cs?name=reward)]
173155

0 commit comments

Comments
 (0)