你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
完成模型训练后,可以查看模型详细信息,了解模型对于测试集表现出的性能。
注意
使用“自动从训练数据拆分测试集”选项,每次训练新模型时可能会产生不同的模型评估结果,因为测试集是从语句中随机选择的。 若要确保在每次训练模型时在同一测试集上计算评估,请确保在启动训练作业时使用手动拆分训练和测试数据选项,并在添加话语时定义测试集。
Prerequisites
在查看模型评估之前,你需要:
有关详细信息,请参阅项目开发生命周期。
模型详细信息
使用以下 URL、标头和 JSON 正文创建 GET 请求,以获取已训练的模型评估摘要。
模型摘要
此 API 返回模型的评估结果摘要,包括意向和实体的精度、召回率、F1 和混淆矩阵。
请求 URL
{ENDPOINT}/language/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}/evaluation/summary-result?api-version={API-VERSION}
| 占位符 | 值 | 示例 |
|---|---|---|
{ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{PROJECT-NAME} |
项目的名称。 此值区分大小写。 | myProject |
{trainedModelLabel} |
已训练的模型的名称。 此值区分大小写。 | Model1 |
{API-VERSION} |
要调用的 API 的版本。 | 2023-04-01 |
头文件
使用以下标头对请求进行身份验证。
| 密钥 | 值 |
|---|---|
Ocp-Apim-Subscription-Key |
资源的密钥。 用于对 API 请求进行身份验证。 |
响应正文
发送请求后,会收到以下响应。
{
"entitiesEvaluation": {
"confusionMatrix": {
"additionalProp1": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
},
"additionalProp2": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
},
"additionalProp3": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
}
},
"entities": {
"additionalProp1": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
},
"additionalProp2": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
},
"additionalProp3": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
}
},
"microF1": 0,
"microPrecision": 0,
"microRecall": 0,
"macroF1": 0,
"macroPrecision": 0,
"macroRecall": 0
},
"intentsEvaluation": {
"confusionMatrix": {
"additionalProp1": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
},
"additionalProp2": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
},
"additionalProp3": {
"additionalProp1": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp2": {
"normalizedValue": 0,
"rawValue": 0
},
"additionalProp3": {
"normalizedValue": 0,
"rawValue": 0
}
}
},
"intents": {
"additionalProp1": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
},
"additionalProp2": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
},
"additionalProp3": {
"f1": 0,
"precision": 0,
"recall": 0,
"truePositivesCount": 0,
"trueNegativesCount": 0,
"falsePositivesCount": 0,
"falseNegativesCount": 0
}
},
"microF1": 0,
"microPrecision": 0,
"microRecall": 0,
"macroF1": 0,
"macroPrecision": 0,
"macroRecall": 0
},
"evaluationOptions": {
"kind": "percentage",
"trainingSplitPercentage": 0,
"testingSplitPercentage": 0
}
}
模型结果
此 API 返回每个语句的单个结果,包括它们对意向和实体的预期和实际预测。
请求 URL
{ENDPOINT}/language/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}/evaluation/result?top={top}&skip={skip}&maxpagesize={maxpagesize}&api-version={API-VERSION}
| 占位符 | 值 | 示例 |
|---|---|---|
{ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{PROJECT-NAME} |
项目的名称。 此值区分大小写。 | myProject |
{trainedModelLabel} |
已训练的模型的名称。 此值区分大小写。 | Model1 |
{API-VERSION} |
要调用的 API 的版本。 | 2023-04-01 |
{top} |
要从集合返回的语句的最大数量。 可选。 | 100 |
{skip} |
要返回的第一个语句集合的偏移量。 可选。 | 100 |
{maxpagesize} |
单个响应中包含的语句的最大数量。 可选 | 100 |
头文件
使用以下标头对请求进行身份验证。
| 密钥 | 值 |
|---|---|
Ocp-Apim-Subscription-Key |
资源的密钥。 用于对 API 请求进行身份验证。 |
响应正文
发送请求后,会收到以下响应。
{
"value": [
{
"text": "send the email",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [],
"predictedEntities": []
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "send a mail to daniel",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 15,
"length": 6
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 15,
"length": 6
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "i forgot to add an important part to that email to james . please set it up to edit",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 51,
"length": 5
}
],
"predictedEntities": [
{
"category": "Category",
"offset": 19,
"length": 9
},
{
"category": "ContactName",
"offset": 51,
"length": 5
}
]
},
"intentsResult": {
"expectedIntent": "AddMore",
"predictedIntent": "AddMore"
}
},
{
"text": "send email to a and tian",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 14,
"length": 1
},
{
"category": "ContactName",
"offset": 20,
"length": 4
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 14,
"length": 1
},
{
"category": "ContactName",
"offset": 20,
"length": 4
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "send thomas an email",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 5,
"length": 6
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 5,
"length": 6
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "i need to add more to the email message i am sending to vincent",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 56,
"length": 7
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 56,
"length": 7
}
]
},
"intentsResult": {
"expectedIntent": "AddMore",
"predictedIntent": "AddMore"
}
},
{
"text": "send an email to lily roth and abc123@microsoft.com",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 17,
"length": 9
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 17,
"length": 9
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "i need to add something else to my email to cheryl",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 44,
"length": 6
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 44,
"length": 6
}
]
},
"intentsResult": {
"expectedIntent": "AddMore",
"predictedIntent": "AddMore"
}
},
{
"text": "send an email to larry , joseph and billy larkson",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 17,
"length": 5
},
{
"category": "ContactName",
"offset": 25,
"length": 6
},
{
"category": "ContactName",
"offset": 36,
"length": 13
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 17,
"length": 5
},
{
"category": "ContactName",
"offset": 25,
"length": 6
},
{
"category": "ContactName",
"offset": 36,
"length": 13
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
},
{
"text": "send mail to dorothy",
"language": "en-us",
"entitiesResult": {
"expectedEntities": [
{
"category": "ContactName",
"offset": 13,
"length": 7
}
],
"predictedEntities": [
{
"category": "ContactName",
"offset": 13,
"length": 7
}
]
},
"intentsResult": {
"expectedIntent": "SendEmail",
"predictedIntent": "SendEmail"
}
}
],
"nextLink": "{Endpoint}/language/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}/evaluation/result/?api-version=2022-10-01-preview&top={top}&skip={skip}&maxpagesize={maxpagesize}"
}
加载或导出模型数据
加载模型数据
使用以下 URL、标头和 JSON 正文创建 POST 请求,以将模型数据加载到项目中。
请求 URL
创建 API 请求时,请使用以下 URL。 将占位符中的值替换为您自己的值。
{ENDPOINT}/language/authoring/analyze-conversations/projects/{PROJECT-NAME}/models/{MODEL-NAME}:load-snapshot?stringIndexType=Utf16CodeUnit&api-version={API-VERSION}
| 占位符 | 值 | 示例 |
|---|---|---|
{ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{PROJECT-NAME} |
项目的名称。 此值区分大小写。 | EmailApp |
{API-VERSION} |
要调用的 API 的版本。 | 2022-10-01-preview |
{MODEL-NAME} |
模型的名称。 此值区分大小写。 | v1 |
头文件
使用以下标头对请求进行身份验证。
| 密钥 | 值 |
|---|---|
Ocp-Apim-Subscription-Key |
资源的密钥。 用于对 API 请求进行身份验证。 |
发送 API 请求后,会收到指示 202 成功的响应。 在响应标头中,提取 operation-location 格式如下的值:
{ENDPOINT}/language/authoring/analyze-conversations/projects/{PROJECT-NAME}/models/{MODEL-NAME}/jobs/{JOB-ID}?api-version={API-VERSION}
JOB-ID 用于标识请求,因为此操作是异步操作。 使用此 URL 可以使用相同的身份验证方法获取模型数据加载的状态。
导出模型数据
使用以下 URL、标头和 JSON 正文创建 POST 请求以导出模型数据。
请求 URL
创建 API 请求时,请使用以下 URL。 将占位符中的值替换为您自己的值。
{ENDPOINT}/language/authoring/analyze-conversations/projects/{PROJECT-NAME}/:export?stringIndexType=Utf16CodeUnit&api-version={API-VERSION}&trainedModelLabel={MODEL-NAME}
| 占位符 | 值 | 示例 |
|---|---|---|
{ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{PROJECT-NAME} |
项目的名称。 此值区分大小写。 | EmailApp |
{API-VERSION} |
要调用的 API 的版本。 | 2022-10-01-preview |
{MODEL-NAME} |
模型的名称。 此值区分大小写。 | v1 |
头文件
使用以下标头对请求进行身份验证。
| 密钥 | 值 |
|---|---|
Ocp-Apim-Subscription-Key |
资源的密钥。 用于对 API 请求进行身份验证。 |
发送 API 请求后,会收到指示 202 成功的响应。 在响应标头中,提取 operation-location 格式如下的值:
{ENDPOINT}/language/authoring/analyze-conversations/projects/{PROJECT-NAME}/jobs/{JOB-ID}?api-version={API-VERSION}
JOB-ID 用于标识请求,因为此操作是异步操作。 使用此 URL 可以通过相同的身份验证方法获取导出的项目 JSON。
删除模型
使用以下 URL、标头和 JSON 正文创建 DELETE 请求,以删除模型。
请求 URL
{ENDPOINT}/language/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}?api-version={API-VERSION}
| 占位符 | 值 | 示例 |
|---|---|---|
{YOUR-ENDPOINT} |
用于对 API 请求进行身份验证的终结点。 | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{PROJECT-NAME} |
项目的名称。 此值区分大小写。 | myProject |
{trainedModelLabel} |
模型的名称。 此值区分大小写。 | model1 |
{API-VERSION} |
要调用的 API 的版本。 | 2023-04-01 |
头文件
使用以下标头对请求进行身份验证。
| 密钥 | 值 |
|---|---|
Ocp-Apim-Subscription-Key |
资源的密钥。 用于对 API 请求进行身份验证。 |
发送 API 请求后,会收到指示 204 成功的响应,这意味着模型被删除。