Botframework-sdk: 驴Is There a way to Limit Score in LUIS MODEL or Intents?

Created on 10 Nov 2017  路  4Comments  路  Source: microsoft/botframework-sdk

I have something like this :

 ` [LuisIntent(LuisRootConstants.SALUDOS)]
    public async Task ObtenerSaludos(IDialogContext context, LuisResult result)
    {

    }
    [LuisIntent(LuisRootConstants.DESPEDIDAS)]
    public async Task ObtenerDespedidas(IDialogContext context, LuisResult result)
    {
        Random rnd = new Random();
        string[] respuesta = { "Si hay algo m谩s en lo que pueda ayudarte, aqu铆 estar茅. Hasta pronto", "Sab茅s donde estoy para lo que necesites" };
        int mIndex = rnd.Next(0, respuesta.Length);

        await Util.GenerateReplying(context);
        await context.PostAsync(respuesta[mIndex]);
        context.Wait(MessageReceived);
    }
    [LuisIntent(LuisRootConstants.AGRADECIMIENTOS)]
    public async Task ObtenerAgradecimientos(IDialogContext context, LuisResult result)
    {
        await Util.GenerateReplying(context);
        await context.PostAsync("No te preocupes, 隆estamos para apoyarte!");
        context.Wait(MessageReceived);
    }
    [LuisIntent(LuisRootConstants.ESTADOANIMO)]
    public async Task ObtenerEstadoAnimo(IDialogContext context, LuisResult result)
    {

    }`

And i want when i type a word just go to the intent if the score is greater than 0.5 is that posible? Thanks for ur help.

All 4 comments

Hi @eflorespalma,

Can I ask you why do you want to do that? If you provide enough training to your model, your should get higher scores and more certainty that your bot understood the intent of the message.

If you accept such low score level you can end up giving the wrong answer more times that you would like to.
Is it the problem that you are getting low scores for all of your intents?

Take a look at how to create Scorables. This might be what you are looking for:
http://www.garypretty.co.uk/2017/04/13/using-scorables-for-global-message-handling-and-interrupt-dialogs-in-bot-framework/
https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-scorable-dialogs

Regards,
Francisco

Yes it is possible.
What you'd have to do is override the method "MessageReceived" on your LuisDialog.

You'll notice on the original method (https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Builder/Dialogs/LuisDialog.cs#L207) that it declares a variable called winner. You'd have to check if the score of the best intent is lower than 0.5, and if so, send it to the "None" intent.

Check this snippet

var winner = BestResultFrom(winners);
if (winner?.BestIntent?.Score < 0.35)
{
      winner.BestIntent.Intent = "None";
}

Hi @FranciscoPonceGomez the problem is that we have many projects on LUIS.... and it麓s hard to test it because we have many intents too so for a beta versi贸n we want to trace all the words with the percent of 0.5 to analyze and improve them or maybe delete them.

@xjose97x Thanks you for answer. Its working.

Can you Help me, please? I'm at the same situation, but have no clue how should I instantiate the winners variable to pass it to BestResultFrom; in other words, I don't know how to instantiate the LuisResult that BestResultFrom has to receive.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vigneshramkumar picture Vigneshramkumar  路  3Comments

mattlanham picture mattlanham  路  3Comments

vaditya04 picture vaditya04  路  3Comments

RaoVenka picture RaoVenka  路  3Comments

akakoychenko picture akakoychenko  路  3Comments