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
description: The confidence score indicates the confidence that the answer is the right match for the given user query.
5
5
services: cognitive-services
6
-
author: tulasim88
6
+
author: diberry
7
7
manager: nitinme
8
8
ms.service: cognitive-services
9
9
ms.subservice: qna-maker
10
10
ms.topic: article
11
-
ms.date: 04/05/2019
12
-
ms.author: tulasim
11
+
ms.date: 06/17/2019
12
+
ms.author: diberry
13
13
ms.custom: seodec18
14
14
---
15
15
# Confidence score of a QnA Maker knowledge base
@@ -40,7 +40,7 @@ The following table indicates typical confidence associated for a given score.
40
40
|0|No match, so the answer is not returned.|"How much does the service cost"|
41
41
42
42
## Choose a score threshold
43
-
The table above shows the scores that are expected on most KBs. However, since every KB is different, and has different types of words, intents and goals- we recommend you test and choose the threshold that best works for you. By default the threshold is set to 0, so that all possible answers are returned. The recommended threshold that should work for most KBs, is **50**.
43
+
The table above shows the scores that are expected on most KBs. However, since every KB is different, and has different types of words, intents, and goals- we recommend you test and choose the threshold that best works for you. By default the threshold is set to 0, so that all possible answers are returned. The recommended threshold that should work for most KBs, is **50**.
44
44
45
45
When choosing your threshold, keep in mind the balance between Accuracy and Coverage, and tweak your threshold based on your requirements.
46
46
@@ -51,6 +51,12 @@ When choosing your threshold, keep in mind the balance between Accuracy and Cove
51
51
> [!NOTE]
52
52
> Newer versions of QnA Maker include improvements to scoring logic, and could affect your threshold. Any time you update the service, make sure to test and tweak the threshold if necessary. You can check your QnA Service version [here](https://www.qnamaker.ai/UserSettings), and see how to get the latest updates [here](../How-To/troubleshooting-runtime.md).
53
53
54
+
## Set threshold
55
+
56
+
Set the threshold score as a property of the [GenerateAnswer API JSON body](../how-to/metadata-generateanswer-usage.md#generateanswer-request-configuration). This means you set it for each call to GenerateAnswer.
57
+
58
+
From the bot framework, set the score as part of the options object with [C#](../how-to/metadata-generateanswer-usage.md?#use-qna-maker-with-a-bot-in-c) or [Node.js](../how-to/metadata-generateanswer-usage.md?#use-qna-maker-with-a-bot-in-nodejs).
59
+
54
60
## Improve confidence scores
55
61
To improve the confidence score of a particular response to a user query, you can add the user query to the knowledge base as an alternate question on that response. You can also use case-insensitive [word alterations](https://docs.microsoft.com/rest/api/cognitiveservices/qnamaker/alterations/replace) to add synonyms to keywords in your KB.
The Support bot has [an example](https://github.com/microsoft/BotBuilder-Samples/blob/master/experimental/qnamaker-support/csharp_dotnetcore/Service/SupportBotService.cs#L418) with this code.
158
+
159
+
## Use QnA Maker with a bot in Node.js
160
+
161
+
The bot framework provides access to the QnA Maker's properties:
162
+
163
+
```javascript
164
+
const { QnAMaker } =require('botbuilder-ai');
165
+
this.qnaMaker=newQnAMaker(endpoint);
166
+
167
+
// Default QnAMakerOptions
168
+
var qnaMakerOptions = {
169
+
ScoreThreshold:0.03,
170
+
Top:3
171
+
};
172
+
var qnaResults =awaitthis.qnaMaker.getAnswers(stepContext.context, qnaMakerOptions);
173
+
```
174
+
175
+
The Support bot has [an example](https://github.com/microsoft/BotBuilder-Samples/blob/master/experimental/qnamaker-activelearning/javascript_nodejs/Helpers/dialogHelper.js#L36) with this code.
176
+
143
177
<aname="metadata-example"></a>
144
178
145
179
## Use metadata to filter answers by custom metadata tags
0 commit comments