Skip to content

Commit c4a6bca

Browse files
authored
Merge pull request #111374 from diberry/diberry/0414-luis-external-entities
[Cogsvcs] LUIS - CSE - external entities
2 parents c14705b + fa8bdfa commit c4a6bca

File tree

6 files changed

+236
-208
lines changed

6 files changed

+236
-208
lines changed

articles/cognitive-services/LUIS/luis-concept-feature.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,40 @@ ms.topic: conceptual
1212
ms.date: 11/03/2019
1313
ms.author: diberry
1414
---
15-
# Machine-learned features
15+
# Machine-learned features
1616

1717
In machine learning, a _feature_ is a distinguishing trait or attribute of data that your system observes & learns through. In Language Understanding (LUIS), a feature describes and explains what is significant about your intents and entities.
1818

19-
In the [preview LUIS portal](https://preview.luis.ai), features are _descriptors_ because they are used to _describe_ the intent or entity.
19+
In the [preview LUIS portal](https://preview.luis.ai), features are _descriptors_ because they are used to _describe_ the intent or entity.
2020

2121
## Features (_descriptors_) in Language Understanding
2222

23-
Features, also known as descriptors, describe clues to help Language Understanding identify the example utterances. Features include:
23+
Features, also known as descriptors, describe clues to help Language Understanding identify the example utterances. Features include:
2424

2525
* Phrase list as a feature to intents or entities
2626
* Entities as features to intents or entities
2727

28-
Features should be considered as a necessary part of your schema for model decomposition.
28+
Features should be considered as a necessary part of your schema for model decomposition.
2929

3030
## What is a phrase list
3131

32-
A phrase list is a list of words, phrases, numbers or other characters that help identify the concept you are trying to identify. The list is case-insensitive.
32+
A phrase list is a list of words, phrases, numbers or other characters that help identify the concept you are trying to identify. The list is case-insensitive.
3333

3434
## When to use a phrase list
3535

36-
With a phrase list, LUIS considers context and generalizes to identify items that are similar to, but not an exact text match. If you need your LUIS app to be able to generalize and identify new items, use a phrase list.
36+
With a phrase list, LUIS considers context and generalizes to identify items that are similar to, but not an exact text match. If you need your LUIS app to be able to generalize and identify new items, use a phrase list.
3737

38-
When you want to be able to recognize new instances, like a meeting scheduler that should recognize the names of new contacts, or an inventory app that should recognize new products, start with a machine-learned entity. Then create a phrase list that helps LUIS find words with similar meaning. This phrase list guides LUIS to recognize examples by adding additional significance to the value of those words.
38+
When you want to be able to recognize new instances, like a meeting scheduler that should recognize the names of new contacts, or an inventory app that should recognize new products, start with a machine-learned entity. Then create a phrase list that helps LUIS find words with similar meaning. This phrase list guides LUIS to recognize examples by adding additional significance to the value of those words.
3939

40-
Phrase lists are like domain-specific vocabulary that help with enhancing the quality of understanding of both intents and entities.
40+
Phrase lists are like domain-specific vocabulary that help with enhancing the quality of understanding of both intents and entities.
4141

4242
## Considerations when using a phrase list
4343

44-
A phrase list is applied, by default, to all models in the app. This will work for phrase lists that can cross all intents and entities. For decomposability, you should apply a phrase list to only the models it is relevant to.
44+
A phrase list is applied, by default, to all models in the app. This will work for phrase lists that can cross all intents and entities. For decomposability, you should apply a phrase list to only the models it is relevant to.
4545

46-
If you create a phrase list (created globally by default), then later apply it as a descriptor (feature) to a specific model, it is removed from the other models. This removal adds relevance to the phrase list for the model it is applied to, helping improve the accuracy it provides in the model.
46+
If you create a phrase list (created globally by default), then later apply it as a descriptor (feature) to a specific model, it is removed from the other models. This removal adds relevance to the phrase list for the model it is applied to, helping improve the accuracy it provides in the model.
4747

48-
The `enabledForAllModels` flag controls this model scope in the API.
48+
The `enabledForAllModels` flag controls this model scope in the API.
4949

5050
<a name="how-to-use-phrase-lists"></a>
5151

@@ -60,29 +60,30 @@ The `enabledForAllModels` flag controls this model scope in the API.
6060
* language that is from another language but frequently used in your app
6161
* key words and phrases in your example utterances
6262

63-
Do **not** add every possible word or phrase. Instead, add a few words or phrases at a time, then retrain and publish. As the list grows over time, you may find some terms have many forms (synonyms). Break these out into another list.
63+
Do **not** add every possible word or phrase. Instead, add a few words or phrases at a time, then retrain and publish. As the list grows over time, you may find some terms have many forms (synonyms). Break these out into another list.
6464

6565
<a name="phrase-lists-help-identify-simple-exchangeable-entities"></a>
6666

67-
## When to use an entity as a feature
67+
## When to use an entity as a feature
6868

69-
An entity can be added as a feature at the intent or the entity level.
69+
An entity can be added as a feature at the intent or the entity level.
7070

7171
### Entity as a feature to an intent
7272

7373
Add an entity as a descriptor (feature) to an intent when the detection of that entity is significant for the intent.
7474

75-
For example, if the intent is for booking a flight and the entity is ticket information (such as the number of seats, origin, and destination), then finding the ticket information entity should add weight to the prediction of the book flight intent.
75+
For example, if the intent is for booking a flight and the entity is ticket information (such as the number of seats, origin, and destination), then finding the ticket information entity should add weight to the prediction of the book flight intent.
7676

7777
### Entity as a feature to another entity
7878

7979
An entity (A) should be added as a feature to another entity (B) when the detection of that entity (A) is significant for the prediction of entity (B).
8080

81-
For example, if the street address entity (A) is detected, then finding the street address (A) adds weight to the prediction for the shipping address entity (B).
81+
For example, if the street address entity (A) is detected, then finding the street address (A) adds weight to the prediction for the shipping address entity (B).
8282

8383
## Best practices
8484
Learn [best practices](luis-concept-best-practices.md).
8585

8686
## Next steps
8787

88-
See [Add Features](luis-how-to-add-features.md) to learn more about how to add features to your LUIS app.
88+
* [Extend](schema-change-prediction-runtime.md) your app models at prediction runtime
89+
* See [Add Features](luis-how-to-add-features.md) to learn more about how to add features to your LUIS app.

articles/cognitive-services/LUIS/luis-migration-api-v3.md

Lines changed: 10 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Prediction endpoint changes in the V3 API
33
description: The query prediction endpoint V3 APIs have changed. Use this guide to understand how to migrate to version 3 endpoint APIs.
44
ms.topic: conceptual
5-
ms.date: 03/11/2020
5+
ms.date: 04/14/2020
66
ms.author: diberry
77
---
88

@@ -11,14 +11,12 @@ ms.author: diberry
1111

1212
The query prediction endpoint V3 APIs have changed. Use this guide to understand how to migrate to version 3 endpoint APIs.
1313

14-
[!INCLUDE [Waiting for LUIS portal refresh](./includes/wait-v3-upgrade.md)]
15-
1614
**Generally available status** - this V3 API include significant JSON request and response changes from V2 API.
1715

1816
The V3 API provides the following new features:
1917

20-
* [External entities](#external-entities-passed-in-at-prediction-time)
21-
* [Dynamic lists](#dynamic-lists-passed-in-at-prediction-time)
18+
* [External entities](schema-change-prediction-runtime.md#external-entities-passed-in-at-prediction-time)
19+
* [Dynamic lists](schema-change-prediction-runtime.md#dynamic-lists-passed-in-at-prediction-time)
2220
* [Prebuilt entity JSON changes](#prebuilt-entity-changes)
2321

2422
The prediction endpoint [request](#request-changes) and [response](#response-changes) have significant changes to support the new features listed above, including the following:
@@ -119,14 +117,12 @@ The V3 API has different query string parameters.
119117

120118
|Property|Type|Version|Default|Purpose|
121119
|--|--|--|--|--|
122-
|`dynamicLists`|array|V3 only|Not required.|[Dynamic lists](#dynamic-lists-passed-in-at-prediction-time) allow you to extend an existing trained and published list entity, already in the LUIS app.|
123-
|`externalEntities`|array|V3 only|Not required.|[External entities](#external-entities-passed-in-at-prediction-time) give your LUIS app the ability to identify and label entities during runtime, which can be used as features to existing entities. |
120+
|`dynamicLists`|array|V3 only|Not required.|[Dynamic lists](schema-change-prediction-runtime.md#dynamic-lists-passed-in-at-prediction-time) allow you to extend an existing trained and published list entity, already in the LUIS app.|
121+
|`externalEntities`|array|V3 only|Not required.|[External entities](schema-change-prediction-runtime.md#external-entities-passed-in-at-prediction-time) give your LUIS app the ability to identify and label entities during runtime, which can be used as features to existing entities. |
124122
|`options.datetimeReference`|string|V3 only|No default|Used to determine [datetimeV2 offset](luis-concept-data-alteration.md#change-time-zone-of-prebuilt-datetimev2-entity). The format for the datetimeReference is [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601).|
125-
|`options.preferExternalEntities`|boolean|V3 only|false|Specifies if user's [external entity (with same name as existing entity)](#override-existing-model-predictions) is used or the existing entity in the model is used for prediction. |
123+
|`options.preferExternalEntities`|boolean|V3 only|false|Specifies if user's [external entity (with same name as existing entity)](schema-change-prediction-runtime.md#override-existing-model-predictions) is used or the existing entity in the model is used for prediction. |
126124
|`query`|string|V3 only|Required.|**In V2**, the utterance to be predicted is in the `q` parameter. <br><br>**In V3**, the functionality is passed in the `query` parameter.|
127125

128-
129-
130126
## Response changes
131127

132128
The query response JSON changed to allow greater programmatic access to the data used most frequently.
@@ -277,185 +273,12 @@ In V3, the same result with the `verbose` flag to return entity metadata:
277273
}
278274
```
279275

280-
## External entities passed in at prediction time
281-
282-
External entities give your LUIS app the ability to identify and label entities during runtime, which can be used as features to existing entities. This allows you to use your own separate and custom entity extractors before sending queries to your prediction endpoint. Because this is done at the query prediction endpoint, you don't need to retrain and publish your model.
283-
284-
The client-application is providing its own entity extractor by managing entity matching and determining the location within the utterance of that matched entity and then sending that information with the request.
285-
286-
External entities are the mechanism for extending any entity type while still being used as signals to other models like roles, composite, and others.
287-
288-
This is useful for an entity that has data available only at query prediction runtime. Examples of this type of data are constantly changing data or specific per user. You can extend a LUIS contact entity with external information from a user's contact list.
289-
290-
### Entity already exists in app
291-
292-
The value of `entityName` for the external entity, passed in the endpoint request POST body, must already exist in the trained and published app at the time the request is made. The type of entity doesn't matter, all types are supported.
293-
294-
### First turn in conversation
295-
296-
Consider a first utterance in a chat bot conversation where a user enters the following incomplete information:
297-
298-
`Send Hazem a new message`
299-
300-
The request from the chat bot to LUIS can pass in information in the POST body about `Hazem` so it is directly matched as one of the user's contacts.
301-
302-
```json
303-
"externalEntities": [
304-
{
305-
"entityName":"contacts",
306-
"startIndex": 5,
307-
"entityLength": 5,
308-
"resolution": {
309-
"employeeID": "05013",
310-
"preferredContactType": "TeamsChat"
311-
}
312-
}
313-
]
314-
```
315-
316-
The prediction response includes that external entity, with all the other predicted entities, because it is defined in the request.
317-
318-
### Second turn in conversation
319-
320-
The next user utterance into the chat bot uses a more vague term:
321-
322-
`Send him a calendar reminder for the party.`
323-
324-
In the previous utterance, the utterance uses `him` as a reference to `Hazem`. The conversational chat bot, in the POST body, can map `him` to the entity value extracted from the first utterance, `Hazem`.
325-
326-
```json
327-
"externalEntities": [
328-
{
329-
"entityName":"contacts",
330-
"startIndex": 5,
331-
"entityLength": 3,
332-
"resolution": {
333-
"employeeID": "05013",
334-
"preferredContactType": "TeamsChat"
335-
}
336-
}
337-
]
338-
```
339-
340-
The prediction response includes that external entity, with all the other predicted entities, because it is defined in the request.
341-
342-
### Override existing model predictions
343-
344-
The `preferExternalEntities` options property specifies that if the user sends an external entity that overlaps with a predicted entity with the same name, LUIS chooses the entity passed in or the entity existing in the model.
345-
346-
For example, consider the query `today I'm free`. LUIS detects `today` as a datetimeV2 with the following response:
347-
348-
```JSON
349-
"datetimeV2": [
350-
{
351-
"type": "date",
352-
"values": [
353-
{
354-
"timex": "2019-06-21",
355-
"value": "2019-06-21"
356-
}
357-
]
358-
}
359-
]
360-
```
361-
362-
If the user sends the external entity:
363-
364-
```JSON
365-
{
366-
"entityName": "datetimeV2",
367-
"startIndex": 0,
368-
"entityLength": 5,
369-
"resolution": {
370-
"date": "2019-06-21"
371-
}
372-
}
373-
```
374-
375-
If the `preferExternalEntities` is set to `false`, LUIS returns a response as if the external entity were not sent.
376-
377-
```JSON
378-
"datetimeV2": [
379-
{
380-
"type": "date",
381-
"values": [
382-
{
383-
"timex": "2019-06-21",
384-
"value": "2019-06-21"
385-
}
386-
]
387-
}
388-
]
389-
```
390-
391-
If the `preferExternalEntities` is set to `true`, LUIS returns a response including:
392-
393-
```JSON
394-
"datetimeV2": [
395-
{
396-
"date": "2019-06-21"
397-
}
398-
]
399-
```
400-
401-
276+
<a name="external-entities-passed-in-at-prediction-time"></a>
277+
<a name="override-existing-model-predictions"></a>
402278

403-
#### Resolution
404-
405-
The _optional_ `resolution` property returns in the prediction response, allowing you to pass in the metadata associated with the external entity, then receive it back out in the response.
406-
407-
The primary purpose is to extend prebuilt entities but it is not limited to that entity type.
408-
409-
The `resolution` property can be a number, a string, an object, or an array:
410-
411-
* "Dallas"
412-
* {"text": "value"}
413-
* 12345
414-
* ["a", "b", "c"]
415-
416-
417-
418-
## Dynamic lists passed in at prediction time
419-
420-
Dynamic lists allow you to extend an existing trained and published list entity, already in the LUIS app.
421-
422-
Use this feature when your list entity values need to change periodically. This feature allows you to extend an already trained and published list entity:
423-
424-
* At the time of the query prediction endpoint request.
425-
* For a single request.
426-
427-
The list entity can be empty in the LUIS app but it has to exist. The list entity in the LUIS app isn't changed, but the prediction ability at the endpoint is extended to include up to 2 lists with about 1,000 items.
428-
429-
### Dynamic list JSON request body
430-
431-
Send in the following JSON body to add a new sublist with synonyms to the list, and predict the list entity for the text, `LUIS`, with the `POST` query prediction request:
432-
433-
```JSON
434-
{
435-
"query": "Send Hazem a message to add an item to the meeting agenda about LUIS.",
436-
"options":{
437-
"timezoneOffset": "-8:00"
438-
},
439-
"dynamicLists": [
440-
{
441-
"listEntity*":"ProductList",
442-
"requestLists":[
443-
{
444-
"name": "Azure Cognitive Services",
445-
"canonicalForm": "Azure-Cognitive-Services",
446-
"synonyms":[
447-
"language understanding",
448-
"luis",
449-
"qna maker"
450-
]
451-
}
452-
]
453-
}
454-
]
455-
}
456-
```
279+
## Extend the app at prediction time
457280

458-
The prediction response includes that list entity, with all the other predicted entities, because it is defined in the request.
281+
Learn [concepts](schema-change-prediction-runtime.md) about how to extend the app at prediction runtime.
459282

460283
## Deprecation
461284

0 commit comments

Comments
 (0)