Skip to content

Commit 02a0689

Browse files
authored
Merge pull request #78906 from diberry/0605-personalizer
[Cogsvcs] Personalizer - moving docs over
2 parents 9042d1c + d58297a commit 02a0689

File tree

4 files changed

+178
-3
lines changed

4 files changed

+178
-3
lines changed

articles/cognitive-services/personalizer/concept-rewards.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Reward score - Personalizer
33
titleSuffix: Azure Cognitive Services
4-
description: The reward score indicates how well the personalization choice, RewardActionID, resulted for the user. The value of the reward score is determined by your business logic, based on observations of user behavior. Personalizer trains it's machine learning models by evaluating the rewards.
4+
description: The reward score indicates how well the personalization choice, RewardActionID, resulted for the user. The value of the reward score is determined by your business logic, based on observations of user behavior. Personalizer trains its machine learning models by evaluating the rewards.
55
services: cognitive-services
66
author: edjez
77
manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: personalizer
1010
ms.topic: overview
11-
ms.date: 05/13/2019
11+
ms.date: 06/07/2019
1212
ms.author: edjez
1313
---
1414

@@ -26,6 +26,18 @@ Rewards are sent after the user behavior has happened, which could be days later
2626

2727
If the reward score for an event hasn't been received within the **Reward Wait Time**, then the **Default Reward** will be applied. Typically, the **[Default Reward](how-to-settings.md#configure-reward-settings-for-the-feedback-loop-based-on-use-case)** is configured to be zero.
2828

29+
30+
## Behaviors and data to consider for rewards
31+
32+
Consider these signals and behaviors for the context of the reward score:
33+
34+
* Direct user input for suggestions when options are involved ("Do you mean X?").
35+
* Session length.
36+
* Time between sessions.
37+
* Sentiment analysis of the user's interactions.
38+
* Direct questions and mini surveys where the bot asks the user for feedback about usefulness, accuracy.
39+
* Response to alerts, or delay to response to alerts.
40+
2941
## Composing reward scores
3042

3143
A Reward score must be computed in your business logic. The score can be represented as:
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Reinforcement Learning - Personalizer
3+
titleSuffix: Azure Cognitive Services
4+
description: "High-performance and high-traffic websites and applications have two main factors to consider with Personalizer for scalability and performance: latency and training throughput."
5+
services: cognitive-services
6+
author: edjez
7+
manager: nitinme
8+
ms.service: cognitive-services
9+
ms.subservice: personalizer
10+
ms.topic: overview
11+
ms.date: 06/07/2019
12+
ms.author: edjez
13+
---
14+
# Scalability and Performance
15+
16+
High-performance and high-traffic websites and applications have two main factors to consider with Personalizer for scalability and performance:
17+
18+
* Keeping low latency when making Rank API calls
19+
* Making sure training throughput keeps up with event input
20+
21+
Personalization can return a rank very rapidly, with most of the call duration dedicated to communication through the REST API. Azure will autoscale the ability to respond to requests rapidly.
22+
23+
## Low-latency scenarios
24+
25+
Some applications require low latencies when returning a rank. This is necessary:
26+
27+
* To keep the user from waiting a noticeable amount of time before displaying ranked content.
28+
* To help a server that is experiencing extreme traffic avoid tying up scarce compute time and network connections.
29+
30+
<!--
31+
32+
If your web site is scaled on your infrastructure, you can avoid making HTTP calls by hosting the Personalizer API in your own servers running a Docker container.
33+
34+
This change would be transparent to your application, other than using an endpoint URL referring to the running docker instances as opposed to an online service in the cloud.
35+
36+
37+
38+
### Extreme Low Latency Scenarios
39+
40+
If you require latencies under a millisecond, and have already tested using Personalizer via containers, please contact our support team so we can assess your scenario and provide guidance suited to your needs.
41+
42+
-->
43+
44+
## Scalability and training throughput
45+
46+
Personalizer works by updating a model that is retrained based on messages sent asynchronously by Personalizer after Rank and Reward APIs. These messages are sent using an Azure EventHub for the application.
47+
48+
It is unlikely most applications will reach the maximum joining and training throughput of Personalizer. While reaching this maximum will not slow down the application, it would imply Event Hub queues are getting filled internally faster than they can be cleaned up.
49+
50+
## How to estimate your throughput requirements
51+
52+
* Estimate the average number of bytes per ranking event adding the lengths of the context and action JSON documents.
53+
* Divide 20MB/sec by this estimated average bytes.
54+
55+
For example, if your average payload has 500 features and each is an estimated 20 characters, then each event is approximately 10kb. With these estimates, 20,000,000 / 10,000 = 2,000 events/sec, which is about 173 million events/day.
56+
57+
If you are reaching these limits, please contact our support team for architecture advice.
58+
59+
## Next steps
60+
61+
[Create and configure Personalizer](how-to-settings.md).

articles/cognitive-services/personalizer/how-personalizer-works.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: personalizer
99
ms.topic: overview
10-
ms.date: 05/07/2019
10+
ms.date: 06/07/2019
1111
ms.author: edjez
1212
---
1313

@@ -75,6 +75,106 @@ Personalizer is based on cutting-edge science and research in the area of [Reinf
7575

7676
* **Model**: A Personalizer model captures all data learned about user behavior, getting training data from the combination of the arguments you send to Rank and Reward calls, and with a training behavior determined by the Learning Policy.
7777

78+
## Example use cases for Personalizer
79+
80+
* Intent clarification & disambiguation: help your users have a better experience when their intent is not clear by providing an option that is personalized to each user.
81+
* Default suggestions for menus & options: have the bot suggest the most likely item in a personalized way as a first step, instead of presenting an impersonal menu or list of alternatives.
82+
* Bot traits & tone: for bots that can vary tone, verbosity, and writing style, consider varying these traits in a personalized ways.
83+
* Notification & alert content: decide what text to use for alerts in order to engage users more.
84+
* Notification & alert timing: have personalized learning of when to send notifications to users to engage them more.
85+
86+
## Checklist for Applying Personalizer
87+
88+
You can apply Personalizer in situations where:
89+
90+
* You have a business or usability goal for your application.
91+
* You have a place in your application where making a contextual decision of what to show to users will improve that goal.
92+
* The best choice can and should be learned from collective user behavior and total reward score.
93+
* The use of machine learning for personalization follows [responsible use guidelines](ethics-responsible-use.md) and choices for your team.
94+
* The decision can be expressed as ranking the best option ([action](concepts-features.md#actions-represent-a-list-of-options) from a limited set of choices.
95+
* How well that choice worked can be computed by your business logic, by measuring some aspect of user behavior, and expressing it in a number between -1 and 1.
96+
* The reward score doesn't bring in too many confounding or external factors, specifically the experiment duration is low enough that the reward score can be computed while it's still relevant.
97+
* You can express the context for the rank as a dictionary of at least 5 features that you think would help make the right choice, and that doesn't include personally identifiable information.
98+
* You have information about each action as a dictionary of at least 5 attributes or features that you think will help Personalizer make the right choice.
99+
* You can retain data for long enough to accumulate a history of at least 100,000 interactions.
100+
101+
## Machine learning considerations for applying Personalizer
102+
103+
Personalizer is based on reinforcement learning, an approach to machine learning that gets taught by feedback you give it.
104+
105+
Personalizer will learn best in situations where:
106+
* There's enough events to stay on top of optimal personalization if the problem drifts over time (such as preferences in news or fashion). Personalizer will adapt to continuous change in the real world, but results won't be optimal if there's not enough events and data to learn from to discover and settle on new patterns. You should choose a use case that happens often enough. Consider looking for use cases that happen at least 500 times per day.
107+
* Context and actions have enough features to facilitate learning.
108+
* There are less than 50 actions for rank per call.
109+
* Your data retention settings allow Personalizer to collect enough data to perform offline evaluations and policy optimization. This is typically at least 50,000 data points.
110+
111+
## How to use Personalizer in a web application
112+
113+
Adding a loop to a web application includes:
114+
115+
* Determine which experience to personalize, what actions and features you have, what context features to use, and what reward you'll set.
116+
* Add a reference to the Personalization SDK in your application.
117+
* Call the Rank API when you are ready to personalize.
118+
* Store the eventId. You send a reward with the Reward API later.
119+
1. Call Activate for the event once you're sure the user has seen your personalized page.
120+
1. Wait for user selection of ranked content.
121+
1. Call Reward API to specify how well the output of the Rank API did.
122+
123+
## How to use Personalizer with a chat bot
124+
125+
In this example, you will see how to use Personalization to make a default suggestion instead of sending the user down a series of menus or choices every time.
126+
127+
* Get the [code](https://github.com/Azure-Samples/cognitive-services-personalizer-samples/tree/master/samples/ChatbotExample) for this sample.
128+
* Set up your bot solution. Make sure to publish your LUIS application.
129+
* Manage Rank and Reward API calls for bot.
130+
* Add code to manage LUIS intent processing. If the **None** is returned as the top intent or the top intent's score is below your business logic threshold, send the intents list to Personalizer to Rank the intents.
131+
* Show intent list to user as selectable links with the first intent being the top-ranked intent from Rank API response.
132+
* Capture the user's selection and send this in the Reward API call.
133+
134+
### Recommended bot patterns
135+
136+
* Make Personalizer Rank API calls every time a disambiguation is needed, as opposed to caching results for each user. The result of disambiguating intent may change over time for one person, and allowing the Rank API to explore variances will accelerate overall learning.
137+
* Choose an interaction that is common with many users so that you have enough data to personalize. For example, introductory questions may be better fits than smaller clarifications deep in the conversation graph that only a few users may get to.
138+
* Use Rank API calls to enable "first suggestion is right" conversations, where the user gets asked "Would you like X?" or "Did you mean X?" and the user can just confirm; as opposed to giving options to the user where they must choose from a menu. For example User:"I'd like to order a coffee" Bot:"Would you like a double espresso?". This way the reward signal is also strong as it pertains directly to the one suggestion.
139+
140+
## How to use Personalizer with a recommendation solution
141+
142+
Use your recommendation engine to filter down a large catalog to a few items which can then be presented as 30 possible actions sent to the Rank API.
143+
144+
You can use recommendation engines with Personalizer:
145+
146+
* Set up the [recommendation solution](https://github.com/Microsoft/Recommenders/).
147+
* When displaying a page, invoke the Recommendation Model to get a short list of recommendations.
148+
* Call Personalization to Rank the Output of Recommendation Solution.
149+
* Send feedback about your user action with the Reward API call.
150+
151+
152+
## Pitfalls to avoid
153+
154+
* Don't use Personalizer where the personalized behavior isn't something that can be discovered across all users but rather something that should be remembered for specific users, or comes from a user-specific list of alternatives. For example, using Personalizer to suggest a first pizza order from a list of 20 possible menu items is useful, but which contact to call from the users' contact list when requiring help with childcare (such as "Grandma") is not something that is personalizable across your user base.
155+
156+
157+
## Adding content safeguards to your application
158+
159+
If your application allows for large variances in content shown to users, and some of that content may be unsafe or inappropriate for some users, you should plan ahead to make sure that the right safeguards are in place to prevent your users from seeing unacceptable content. The best pattern to implement safeguards is:
160+
The best pattern to implement safeguards is:
161+
* Obtain the list of actions to rank.
162+
* Filter out the ones that are not viable for the audience.
163+
* Only rank these viable actions.
164+
* Display the top ranked action to the user.
165+
166+
In some architectures, the above sequence may be hard to implement. In that case, there is an alternative approach to implementing safeguards after ranking, but a provision needs to be made so actions that falls outside the safeguard are not used to train the Personalizer model.
167+
168+
* Obtain the list of actions to rank, with learning deactivated.
169+
* Rank actions.
170+
* Check if the top action is viable.
171+
* If the top action is viable, activate learning for this rank, then show it to the user.
172+
* If the top action is not viable, do not activate learning for this ranking, and decide through your own logic or alternative approaches what to show to the user. Even if you use the second-best ranked option, do not activate learning for this ranking.
173+
174+
## Verifying adequate effectiveness of Personalizer
175+
176+
You can monitor the effectiveness of Personalizer periodically by performing [offline evaluations](how-to-offline-evaluation.md)
177+
78178
## Next steps
79179

80180
Understand [where you can use Personalizer](where-can-you-use-personalizer.md).

articles/cognitive-services/personalizer/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
- name: Offline evaluation
4444
href: concepts-offline-evaluation.md
4545
displayName: learning policy, Counterfactual, features
46+
- name: Scalability and performance
47+
href: concepts-scalability-performance.md
4648
- name: How-to guides
4749
items:
4850
- name: Create and configure Personalizer

0 commit comments

Comments
 (0)