Skip to content

Commit 3da220a

Browse files
authored
Merge pull request #100660 from diberry/diberry/0109-personalizer-doc-ref-docs
[Cogsvcs] Personalizer - Node.js SDK reference
2 parents 79fbb4b + 6901273 commit 3da220a

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

articles/cognitive-services/personalizer/python-quickstart-commandline-feedback-loop.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "Quickstart: Personalizer client library for Python"
33
titleSuffix: Azure Cognitive Services
4-
description: This quickstart shows how to get started with the Personalizer client library for Python using a learning loop.
4+
description: This quickstart shows how to get started with the Personalizer client library for Python using a learning loop.
55
services: cognitive-services
66
author: diberry
77
manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: personalizer
1010
ms.topic: quickstart
11-
ms.date: 10/23/2019
11+
ms.date: 01/09/2020
1212
ms.author: diberry
1313
#Customer intent: As a developer, I want implement a Personalizer loop so that I can understand how to use the Rank and Reward calls.
1414
---
@@ -22,7 +22,7 @@ Get started with the Personalizer client library for Python. Follow these steps
2222
* Rank a list of actions for personalization.
2323
* Report reward score indicating success of top ranked action.
2424

25-
[Package (pypi)](https://pypi.org/project/azure-cognitiveservices-personalizer/) | [Samples](https://github.com/Azure-Samples/cognitive-services-personalizer-samples/blob/master/quickstarts/python/sample.py)
25+
[Reference documentation](https://docs.microsoft.com/python/api/overview/azure/cognitiveservices/personalizer?view=azure-python) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cognitiveservices/azure-cognitiveservices-personalizer)| [Package (pypi)](https://pypi.org/project/azure-cognitiveservices-personalizer/) | [Samples](https://github.com/Azure-Samples/cognitive-services-personalizer-samples/blob/master/quickstarts/python/sample.py)
2626

2727
## Prerequisites
2828

@@ -45,7 +45,7 @@ There are several steps to use this quickstart:
4545

4646
Azure Cognitive Services are represented by Azure resources that you subscribe to. Create a resource for Personalizer using the [Azure portal](https://portal.azure.com/) or [Azure CLI](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli) on your local machine. Please refer to [How to create a Cognitive Services resource using the Azure portal](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) for more details. You can also:
4747

48-
* 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/).
48+
* 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/).
4949
* View your resource on the [Azure portal](https://portal.azure.com/).
5050

5151
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):
@@ -76,11 +76,11 @@ When a Personalizer loop is first instantiated, there is no model since there ha
7676

7777
The Personalizer client is a PersonalizerClient object that authenticates to Azure using Microsoft.Rest.ServiceClientCredentials, which contains your key.
7878

79-
To ask for a rank of the content, create a RankRequest, then pass it to client.Rank method. The Rank method returns a RankResponse, containing the ranked content.
79+
To ask for a rank of the content, create a RankRequest, then pass it to client.Rank method. The Rank method returns a RankResponse, containing the ranked content.
8080

81-
To send a reward to Personalizer, create a RewardRequest, then pass it to the client.Reward method.
81+
To send a reward to Personalizer, create a RewardRequest, then pass it to the client.Reward method.
8282

83-
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 should be one of the primary design decisions in your Personalizer architecture.
83+
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 should be one of the primary design decisions in your Personalizer architecture.
8484

8585
## Code examples
8686

@@ -92,7 +92,7 @@ These code snippets show you how to do the following with the Personalizer clien
9292

9393
## Create a new python application
9494

95-
Create a new Python application in your preferred editor or IDE named `sample.py`.
95+
Create a new Python application in your preferred editor or IDE named `sample.py`.
9696

9797
## Add the dependencies
9898

@@ -126,7 +126,7 @@ Actions represent the content choices you want Personalizer to rank. Add the fol
126126

127127
## Create the learning loop
128128

129-
The Personalizer learning loop is a cycle of [rank](#request-a-rank) 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 ranked the content.
129+
The Personalizer learning loop is a cycle of [rank](#request-a-rank) 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 ranked the content.
130130

131131
The following code 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.
132132

@@ -142,17 +142,17 @@ Add the following methods, which [get the content choices](#get-content-choices-
142142

143143
## Request a rank
144144

145-
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.
145+
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.
146146

147-
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.
147+
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.
148148

149149
[!code-python[The Personalizer learning loop ranks the request.](~/samples-personalizer/quickstarts/python/sample.py?name=rank)]
150150

151151
## Send a reward
152152

153153
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.
154154

155-
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.
155+
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.
156156

157157
[!code-python[The Personalizer learning loop sends a reward.](~/samples-personalizer/quickstarts/python/sample.py?name=reward&highlight=9)]
158158

articles/cognitive-services/personalizer/quickstart-command-line-feedback-loop-nodejs-sdk.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "Quickstart: Personalizer client library for Node.js"
33
titleSuffix: Azure Cognitive Services
4-
description: This quickstart shows how to get started with the Personalizer client library for Node.js using a learning loop.
4+
description: This quickstart shows how to get started with the Personalizer client library for Node.js using a learning loop.
55
services: cognitive-services
66
author: diberry
77
manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: personalizer
1010
ms.topic: quickstart
11-
ms.date: 10/23/2019
11+
ms.date: 01/09/2020
1212
ms.author: diberry
1313
#Customer intent: As a developer, I want implement a Personalizer loop so that I can understand how to use the Rank and Reward calls.
1414

@@ -23,7 +23,7 @@ Get started with the Personalizer client library for Node.js. Follow these steps
2323
* Rank a list of actions for personalization.
2424
* Report reward score indicating success of top ranked action.
2525

26-
[Library source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-personalizer) | [Package (NPM)](https://www.npmjs.com/package/@azure/cognitiveservices-personalizer) | [Samples](https://github.com/Azure-Samples/cognitive-services-personalizer-samples/blob/master/quickstarts/node/sample.js)
26+
[Reference documentation](https://docs.microsoft.com/javascript/api/@azure/cognitiveservices-personalizer/?view=azure-node-latest) | [Library source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-personalizer) | [Package (NPM)](https://www.npmjs.com/package/@azure/cognitiveservices-personalizer) | [Samples](https://github.com/Azure-Samples/cognitive-services-personalizer-samples/blob/master/quickstarts/node/sample.js)
2727

2828
## Prerequisites
2929

@@ -46,7 +46,7 @@ There are several steps to use this quickstart:
4646

4747
Azure Cognitive Services are represented by Azure resources that you subscribe to. 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:
4848

49-
* 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/).
49+
* 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/).
5050
* View your resource on the [Azure portal](https://portal.azure.com/).
5151

5252
After you get a key from your trial subscription or resource, create two [environment variables](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account#configure-an-environment-variable-for-authentication):
@@ -59,13 +59,13 @@ In the Azure portal, both the key and endpoint values are available from the **Q
5959

6060
## Create a new Node.js application
6161

62-
In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it.
62+
In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it.
6363

6464
```console
6565
mkdir myapp && cd myapp
6666
```
6767

68-
Run the `npm init -y` command to create a `package.json` file.
68+
Run the `npm init -y` command to create a `package.json` file.
6969

7070
```console
7171
npm init -y
@@ -97,11 +97,11 @@ When a Personalizer loop is first instantiated, there is no model since there ha
9797

9898
The Personalizer client is a PersonalizerClient object that authenticates to Azure using Microsoft.Rest.ServiceClientCredentials, which contains your key.
9999

100-
To ask for a rank of the content, create a RankRequest, then pass it to client.Rank method. The Rank method returns a RankResponse, containing the ranked content.
100+
To ask for a rank of the content, create a RankRequest, then pass it to client.Rank method. The Rank method returns a RankResponse, containing the ranked content.
101101

102-
To send a reward to Personalizer, create a RewardRequest, then pass it to the client.Reward method.
102+
To send a reward to Personalizer, create a RewardRequest, then pass it to the client.Reward method.
103103

104-
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 should be one of the primary design decisions in your Personalizer architecture.
104+
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 should be one of the primary design decisions in your Personalizer architecture.
105105

106106
## Code examples
107107

@@ -113,7 +113,7 @@ These code snippets show you how to do the following with the Personalizer clien
113113

114114
## Create a new Node.js application
115115

116-
Create a new Node.js application in your preferred editor or IDE named `sample.js`.
116+
Create a new Node.js application in your preferred editor or IDE named `sample.js`.
117117

118118
## Add the dependencies
119119

@@ -143,7 +143,7 @@ Actions represent the content choices you want Personalizer to rank. Add the fol
143143

144144
## Create the learning loop
145145

146-
The Personalizer learning loop is a cycle of [rank](#request-a-rank) 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 ranked the content.
146+
The Personalizer learning loop is a cycle of [rank](#request-a-rank) 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 ranked the content.
147147

148148
The following looping code 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.
149149

@@ -158,17 +158,17 @@ Add the following methods, which [get the content choices](#get-content-choices-
158158

159159
## Request a rank
160160

161-
To complete the rank request, the program asks the user's preferences to create content choices. The process can create content to exclude from the rank, shown as `excludeActions`. The rank request needs the [actions](concepts-features.md#actions-represent-a-list-of-options), currentContext, excludeActions, and a unique rank event ID (as a GUID), to receive the ranked response.
161+
To complete the rank request, the program asks the user's preferences to create content choices. The process can create content to exclude from the rank, shown as `excludeActions`. The rank request needs the [actions](concepts-features.md#actions-represent-a-list-of-options), currentContext, excludeActions, and a unique rank event ID (as a GUID), to receive the ranked response.
162162

163-
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.
163+
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.
164164

165165
[!code-javascript[The Personalizer learning loop ranks the request.](~/samples-personalizer/quickstarts/node/sample.js?name=rank)]
166166

167167
## Send a reward
168168

169169
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.
170170

171-
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.
171+
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.
172172

173173
[!code-javascript[The Personalizer learning loop sends a reward.](~/samples-personalizer/quickstarts/node/sample.js?name=reward)]
174174

articles/cognitive-services/personalizer/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
href: https://github.com/Azure/azure-sdk-for-go/tree/master/services/preview/personalizer/v1.0/personalizer
9393
- name: Node.js
9494
items:
95+
- name: Reference
96+
href: https://docs.microsoft.com/javascript/api/@azure/cognitiveservices-personalizer/?view=azure-node-latest
9597
- name: NPM
9698
href: https://www.npmjs.com/package/@azure/cognitiveservices-personalizer/v/1.0.0
9799
- name: Python

0 commit comments

Comments
 (0)