问题描述
当我调用 LUIS API 时,我会获得与我的意图相关的置信度分数。我也得到了一个实体列表,但我没有得到相应的置信度分数。我如何获得置信度分数?
解决方法
这在某种程度上取决于您调用 API 的方式(直接调用或使用某些连接器/识别器)。我的回答假设您是通过 URL 直接调用的。在这种情况下,您是否有信心将取决于实体的类型。像 Regex 或 List 实体这样的东西不会有信心,因为它们只有在 100% 匹配时才会被识别。如果您使用机器学习实体,您将获得置信度分数。不确定任何其他实体类型或功能。这是我的应用程序中的示例负载。你可以看到我有一个 orderNumberML 和一个 orderNumber 实体,前者是机器学习的,有一个置信度值,后者正则表达式没有。您必须进入 $instance
属性,因为顶级 json.prediction.entities 只会为您提供列表,而无需任何其他上下文。
{
"query":"what is the status of order ABC123 and order DEF456?","prediction":{
"topIntent":"viewOrder","intents":{
"viewOrder":{
"score":0.999304056
},"cancelChangeQuantity":{
"score":0.0195436124
},"escalate":{
"score":0.018896237
},"qna":{
"score":0.0164053086
},"changeShipMethod":{
"score":0.0147548188
},"expediteOrder":{
"score":0.0100477394
},"mainMenu":{
"score":0.00383487041
},"requestCoc":{
"score":0.00324145844
},"orderShortage":{
"score":0.00208944362
},"Utilities.Help":{
"score":0.00205096183
},"generalSupport":{
"score":0.001971956
},"trcSupport":{
"score":0.00169838977
},"trcEscalate":{
"score":0.00165500911
},"getPricing":{
"score":0.00135509949
},"getAvailability":{
"score":0.00125210814
},"orderOverage":{
"score":0.000846677169
},"srStatus":{
"score":0.0006817043
},"shippingProblem":{
"score":0.000577154336
},"warrantyClaim":{
"score":0.000458181225
},"getTranscript":{
"score":0.000367239147
},"None":{
"score":0.000275740429
},"manageProfile":{
"score":0.0002755769
},"confirmShipDate":{
"score":0.0001726267
},"Utilities.Cancel":{
"score":7.628063E-05
}
},"entities":{
"orderNumberML":[
"ABC123","DEF456"
],"orderNumber":[
"ABC123","$instance":{
"orderNumberML":[
{
"type":"orderNumberML","text":"ABC123","startIndex":28,"length":6,"score":0.916349649,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":[
"model"
]
},{
"type":"orderNumberML","text":"DEF456","startIndex":45,"score":0.9027585,"recognitionSources":[
"model"
]
}
],"orderNumber":[
{
"type":"orderNumber","modelTypeId":8,"modelType":"Regex Entity Extractor",{
"type":"orderNumber","recognitionSources":[
"model"
]
}
]
}
}
}
}