Wrong intent selected

Rasa is not able to predict the correct intent if I jump stories. See below, if I type “good morning” after “hello”, it is not able to understand. Because in the stories, good_morning was a separate story, but in a real-world scenario, it is possible that users jump stories and start a new story in the middle of an existing story.

Shouldn’t the NLU and intent matching threshold be given priority in this case?

Your input ->  qqq
Sorry I could not underastand.
Your input ->  hello
Hey! How are you?
Your input ->  good morning
Sorry I could not underastand.            <------ this
Your input ->  how are you
I am good, you tell.
Your input ->  i am sad
Here is something to cheer you up:
Image: https://i.imgur.com/nGF1K8f.jpg
Did that help you?
Your input ->  yep
Sorry I could not underastand.
Your input ->  i am sad
Great, carry on!                                  <----------------- this

config:

language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: CRFEntityExtractor
- name: EntitySynonymMapper
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: EmbeddingIntentClassifier
policies:
- name: MemoizationPolicy
  max_history: 5
- name: KerasPolicy
  featurizer:
    - name: MaxHistoryTrackerFeaturizer
      max_history: 5
      state_featurizer:
        - name: BinarySingleStateFeaturizer
- name: MappingPolicy
- name: "FallbackPolicy"
  nlu_threshold: 0.4
  core_threshold: 0.3
  fallback_action_name: "action_default_fallback"

Stories:

happy path

  • greet
    • utter_greet
  • mood_great
    • utter_happy

sad path 1

  • greet
    • utter_greet
  • mood_unhappy
    • utter_cheer_up
    • utter_did_that_help
  • affirm
    • utter_happy

sad path 2

  • greet
    • utter_greet
  • mood_unhappy
    • utter_cheer_up
    • utter_did_that_help
  • deny
    • utter_goodbye

say goodbye

  • goodbye
    • utter_goodbye

bot challenge

  • bot_challenge
    • utter_iamabot

happy path 2

  • greet
    • utter_greet
  • how_are_you
    • utter_i_am_good
  • mood_great
    • utter_happy
    • utter_goodbye

good morning

  • good_morning
    • utter_good_morning

Hello @sid8491,

If i’m not mistaking, this is because of the ‘greet’ intent in your stories is always followed up by some intents which is not ‘good morning’. You didn’t provide a story in which ‘greet’ stand alone, which means after that it can be any intent. Right now the bot simply learn from your data that ‘greet’ is always followed up by some specific intents.

That’s my guess. You can try to create a story in which the ‘greet’ intent stands alone and see how it goes. Hope that helps :smiley:

Hi @fuih I understand what you are saying, but I was wondering there might be cases where users will start another story in-between conversation. In that case, shouldn’t be NLU part be given priority if it is matching with a very good score.

Is there any way to tune between core part (story-driven intent matching) and nlu part (nlu score intent matching).

Dialogflow has a very good way for this implementation.

From my experience, if your intent can be followed up by different intents, you can create their own story which only include that intent, and then if there is any specific flow you want to cover, you’ll add the story which includes multiple intents. For example, 4 intent A, B, C, D separately can have various order A->B, C->A, A->C->D,… You can achieve this by having 4 stories that includes A, B, C or D only.

But if you have different flows in which there are specific intents, such as flow 1 (A, B, C) and flow 2 (E, F, G) and they are not flexible, which means they always should follow such order. It will be hard to change from flow 1 to flow 2 while you are in the middle of flow 1, without specifically have a story for that situation.

I understand your idea, but i’m afraid that with this kind of approach, we’ll completely bypass the core component, it will just predict the intent with the NLU and immediately response, ignore the whole story part.

I think the purpose of stories and core is that if the user is in a middle of a flow, and they do something out of ordinary but still comprehensible, the bot will detect that it’s not normal.

But at the same time, this limits the flexibility of the bot, in case if we want the user to be able to change actions or functions easily, even in the middle of a flow, we would have to define a story for every situation, or create a custom way to redirect the bot (currently I’m using this approach).