The goal of this sample is to show how to use Personalization API with the crawl featurizer pipeline
- Clone the Azure Personalization Service
git clone https://github.com/Azure/personalization-rl.git- Navigate to quickstart\CrawlFeaturizer
- Open
CrawlFeaturizer.sln
-
Navigate to Getting Started with Personalization
-
Follow the instructions to get the endpoint and key to your Personalization Loop
-
Replace
ApiKeyvariable's value inPrograms.cswith the loopKey -
Replace
ServiceEndpointvariable's value inPrograms.cswith theEndpointurl
-
Navigate to Microsoft Azure Cognitive Services.
-
Click on
Language APIstab. -
Click on
Get API Keybutton and select the account you want to sign in with. -
Replace
cognitiveTextAnalyticsEndpointvariable's value inPrograms.cswith one of theEndpoints -
Replace
CognitiveTextAnalyticsAPIKeyvariable's value inPrograms.cswith one of theKeys
-
Set
CrawlFeaturizeras the Start Up project in Visual Studio -
Run the project (press
F5key)
The Crawl pipeline consists of 2 stages
- Crawl a feed url and get all the items listed in the feed. These items are the
Actionsthat will be ranked by Personalization API. This is exposed through theIActionsProviderinterface. - Each
Actionis decorated withFeaturesby using someActionFeaturizere.g Cognitive Services Text Analytics, Cognitive Services Vision. This functionality is exposed through theIActionFeaturizerinterface. Once we have a set of actions with features, those actions can be ranked using the Personalization API.
-
6 News Topics and their RSS feed urls are hardcoded in the program
-
When the program starts, the RSSFeedActionProvider accesses each RSS Feed and creates a collection of CrawlActions for each of the news articles listed in the feed.
-
Next, each CrawlAction is sent to the Cognitive Services Text Analytics endpoint to extract key word phrases and get a sentiment score. These along with the articles news topic and title are used as features for the article
-
In the user interaction loop, the user is asked the
time of dayandlocationwhere he/she would be reading the article. All the articles then passed to the Personalization API endpoint for ranking along with the given user context. -
Once ranking is done the top ranked article is displayed to the user asked if he/she would read it.
-
The user provided reward value (yes/no) is then passed to the Personalization API endpoint as reward.
-
Backend
OnlineTrainerlearns user preferences by analysing the reward values for the user context and recommended article. -
Overtime the system learns the user's preferences and starts returning very accurate news article recommendations.