Reader small image

You're reading from  Learning Microsoft Cognitive Services

Product typeBook
Published inMar 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786467843
Edition1st Edition
Languages
Right arrow
Author (1)
Leif Larsen
Leif Larsen
author image
Leif Larsen

Leif Larsen is a software engineer based in Norway. After earning a degree in computer engineering, he went on to work with the design and configuration of industrial control systems, for the most part, in the oil and gas industry. Over the last few years, he has worked as a developer, developing and maintaining geographical information systems, working with .NET technology. Today, he is working with a start-up, developing a brand new SaaS product. In his spare time, he develops mobile apps and explores new technologies to keep up with the high-paced tech world. You can find out more about him by checking out his blog, "Leif Larsen", and following him on Twitter (@leif_larsen) and LinkedIn (lhlarsen).
Read more about Leif Larsen

Right arrow

Chapter 7. Extending Knowledge Based on Context

By leveraging Azure Machine Learning and the Recommendations API, we have launched a new Personalized Commerce Experience for retailers that grows shopper conversion and engagement on any channel.

                                               - Frank Kouretas, Chief Product Officer at Orckestra

With the previous chapter, we covered the remaining Language APIs. In this chapter, we will look into the first two Knowledge APIs: the Entity Linking API and the Recommendations API. We will start by learning how to link entities in text. Using the Entity Linking API, we can identify different entities in text, based on the context. Moving on, we will look into the Recommendations API. This is well-suited for e-commerce applications, where you can recommend different items based on different criteria.

With this chapter completed, we will have covered the following topics:

  • Recognizing and identifying separate entities in text, based on context

  • Recommending...

Linking entities based on context


Using the Entity Linking API, we can link entities in text based on the context. Doing so means that we can separate the meaning of a word, based on the usage in the given text. A word, such as times, may mean the newspaper The New York Times. The same word can also be used in a place name, Times Square. The context decides which of the two entities times represents. The API detects entities within given text, and relates all entities to a Wikipedia entry.

We are going to add entity-linking capabilities to our Smart-House application. For now, we will just add a text field input, but in later chapters we will see how it can be utilized.

In Visual Studio, add the Microsoft.ProjectOxford.EntityLinking NuGet package to the project. This contains the client library required to use the API.

Add a new file, the EntityLinking.cs file, to the Model folder. Beneath the class, EntityLinking, add a new class called EntityLinkingErrorEventArgs. This will allow us to raise...

Providing personalized recommendations


If you run an e-commerce site, a feature that is nice to have is recommendations. Using the Recommendation API, you can easily add this. Utilizing Microsoft Azure Machine Learning, the API can be trained to recognize items that should be recommended.

There are three common scenarios for recommendations, as follows:

  • Frequently Bought Together (FBT): FBT is the scenario where items that are often bought together with other items are recommended. An example of this is if you buy a mouse; the API will then recommend a keyboard.

  • Item to Item Recommendations (I2I): I2I is the scenario where certain items are often viewed after other items. Typically, this will be in form of people who visited this item also visited this other item.

  • Customer to Item Recommendations (U2I): U2I is the scenario where you utilize a customer's previous actions to recommend items. If you sell movies, you can recommend other movies based on a customer's previous movie choices.

The...

Summary


Throughout this chapter, we have taken our first look at the Knowledge APIs. We started by linking entities using the Entity Linking API. Doing so allows us to recognize entities based on context and link all entities of the same type in a text. Moving on, we dived into the Recommendations API. We learned how to set up recommendation models using existing catalog and usage data. Using these models, we learned how to utilize these in a simple example application.

In the next chapter, we will continue with Knowledge APIs. We will learn how to structure natural language queries and evaluate query expressions. In addition, we will learn how to add auto-completion to natural language queries.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning Microsoft Cognitive Services
Published in: Mar 2017Publisher: PacktISBN-13: 9781786467843
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Leif Larsen

Leif Larsen is a software engineer based in Norway. After earning a degree in computer engineering, he went on to work with the design and configuration of industrial control systems, for the most part, in the oil and gas industry. Over the last few years, he has worked as a developer, developing and maintaining geographical information systems, working with .NET technology. Today, he is working with a start-up, developing a brand new SaaS product. In his spare time, he develops mobile apps and explores new technologies to keep up with the high-paced tech world. You can find out more about him by checking out his blog, "Leif Larsen", and following him on Twitter (@leif_larsen) and LinkedIn (lhlarsen).
Read more about Leif Larsen