Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the C# portion of #3706 #4383

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public class QnAMakerDialog : WaterfallDialog
private const string DefaultCardNoMatchText = "None of the above.";
private const string DefaultCardNoMatchResponse = "Thanks for the feedback.";

private float _maximumScoreForLowScoreVariation = 0.95F;

/// <summary>
/// Initializes a new instance of the <see cref="QnAMakerDialog"/> class.
/// </summary>
Expand Down Expand Up @@ -504,8 +502,8 @@ private async Task<DialogTurnResult> CallGenerateAnswerAsync(WaterfallStepContex
stepContext.Values[ValueProperty.QnAData] = new List<QueryResult>(response.Answers);

// Check if active learning is enabled.
// _maximumScoreForLowScoreVariation is the score above which no need to check for feedback.
if (response.Answers.Any() && response.Answers.First().Score <= _maximumScoreForLowScoreVariation)
// MaximumScoreForLowScoreVariation is the score above which no need to check for feedback.
if (response.Answers.Any() && response.Answers.First().Score <= (ActiveLearningUtils.MaximumScoreForLowScoreVariation / 100))
{
// Get filtered list of the response that support low score variation criteria.
response.Answers = qnaClient.GetLowScoreVariation(response.Answers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ namespace Microsoft.Bot.Builder.AI.QnA
/// </summary>
public static class ActiveLearningUtils
{
/// <summary>
/// Minimum Score For Low Score Variation.
/// </summary>
private const double MinimumScoreForLowScoreVariation = 20.0;

/// <summary>
/// Previous Low Score Variation Multiplier.
/// </summary>
Expand All @@ -27,9 +22,20 @@ public static class ActiveLearningUtils
private const double MaxLowScoreVariationMultiplier = 1.0;

/// <summary>
/// Gets or sets maximum Score For Low Score Variation.
/// </summary>
/// <value>
/// Maximum Score For Low Score Variation.
/// </value>
public static double MaximumScoreForLowScoreVariation { get; set; } = 95.0;

/// <summary>
/// Gets or sets minimum Score For Low Score Variation.
/// </summary>
private const double MaximumScoreForLowScoreVariation = 95.0;
/// <value>
/// Minimum Score For Low Score Variation.
/// </value>
public static double MinimumScoreForLowScoreVariation { get; set; } = 20.0;

/// <summary>
/// Returns list of qnaSearch results which have low score variation.
Expand All @@ -56,10 +62,10 @@ public static List<QueryResult> GetLowScoreVariation(List<QueryResult> qnaSearch
filteredQnaSearchResult.Add(qnaSearchResults[0]);
return filteredQnaSearchResult;
}

var prevScore = topAnswerScore;

if (topAnswerScore > MinimumScoreForLowScoreVariation)
if (topAnswerScore > MinimumScoreForLowScoreVariation)
{
filteredQnaSearchResult.Add(qnaSearchResults[0]);

Expand Down