You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/LUIS/luis-concept-feature.md
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,40 +12,40 @@ ms.topic: conceptual
12
12
ms.date: 11/03/2019
13
13
ms.author: diberry
14
14
---
15
-
# Machine-learned features
15
+
# Machine-learned features
16
16
17
17
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.
18
18
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.
20
20
21
21
## Features (_descriptors_) in Language Understanding
22
22
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:
24
24
25
25
* Phrase list as a feature to intents or entities
26
26
* Entities as features to intents or entities
27
27
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.
29
29
30
30
## What is a phrase list
31
31
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.
33
33
34
34
## When to use a phrase list
35
35
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.
37
37
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.
39
39
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.
41
41
42
42
## Considerations when using a phrase list
43
43
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.
45
45
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.
47
47
48
-
The `enabledForAllModels` flag controls this model scope in the API.
48
+
The `enabledForAllModels` flag controls this model scope in the API.
49
49
50
50
<aname="how-to-use-phrase-lists"></a>
51
51
@@ -60,29 +60,30 @@ The `enabledForAllModels` flag controls this model scope in the API.
60
60
* language that is from another language but frequently used in your app
61
61
* key words and phrases in your example utterances
62
62
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.
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.
70
70
71
71
### Entity as a feature to an intent
72
72
73
73
Add an entity as a descriptor (feature) to an intent when the detection of that entity is significant for the intent.
74
74
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.
76
76
77
77
### Entity as a feature to another entity
78
78
79
79
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).
80
80
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).
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.
119
117
120
118
|Property|Type|Version|Default|Purpose|
121
119
|--|--|--|--|--|
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. |
124
122
|`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. |
126
124
|`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.|
127
125
128
-
129
-
130
126
## Response changes
131
127
132
128
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:
277
273
}
278
274
```
279
275
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:
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
457
280
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.
0 commit comments