Stories are not working if there is Rule Policy in the Config file

Ted Policy is prediction is not executed since the policy_2_RulePolicy predicted policy_2_RulePolicy. How do I resolve this situation, I am unable to write a story, because everytime rule policy predicts fall back

stories:
 - story: Find Direction
   steps:
    - intent: route_map
    - action: action_get_direction

2021-09-19 19:49:35 DEBUG    rasa.core.policies.memoization  - Current tracker state [{}, {'user': {'intent': 'route_map', 'entities': ('hotel_name',)}, 'prev_action': {'action_name': 'action_listen'}}]
2021-09-19 19:49:35 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
2021-09-19 19:49:35 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_get_direction' based on user intent.
2021-09-19 19:49:35 DEBUG    rasa.core.policies.rule_policy  - Current tracker state:
[state 1] user text: find me the direction to Festive Hotel | previous action name: action_listen
2021-09-19 19:49:35 DEBUG    rasa.core.policies.rule_policy  - There is no applicable rule.
2021-09-19 19:49:35 DEBUG    rasa.core.policies.rule_policy  - Current tracker state:
[state 1] user intent: route_map | user entities: ('hotel_name',) | previous action name: action_listen
2021-09-19 19:49:35 DEBUG    rasa.core.policies.rule_policy  - There is no applicable rule.
2021-09-19 19:49:35 DEBUG    rasa.core.policies.ensemble  - Made prediction using user intent.
2021-09-19 19:49:35 DEBUG    rasa.core.policies.ensemble  - Added `DefinePrevUserUtteredFeaturization(False)` event.
2021-09-19 19:49:35 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_2_RulePolicy.
2021-09-19 19:49:35 DEBUG    rasa.core.processor  - Predicted next action 'action_default_fallback' with confidence 0.40.

@athulvingt Can you please share the config.yml file?

version: "2.0"
language: en_core_web_md
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: RegexEntityExtractor
  - name: EntitySynonymMapper
  - name: ResponseSelector
    epochs: 100
    retrieval_intent: faq
  - name: ResponseSelector
    epochs: 100
    retrieval_intent: chitchat
  - name: FallbackClassifier
    threshold: 0.7
  - name: DucklingEntityExtractor
    url: http://duckling.rasa.com:8000
    dimensions:
    - amount-of-money
    - time
    - number
    - phone-number
    - duration
  - name: SpacyNLP
    model: "en_core_web_md"
    case_sensitive: false
  - name: "SpacyEntityExtractor"
    # Note: It is not possible to use the SpacyTokenizer + SpacyFeaturizer in
    #       combination with the WhitespaceTokenizer, and as a result the
    #       PERSON extraction by Spacy is not very robust.
    #       Because of this, the nlu training data is annotated as well, and the
    #       DIETClassifier will also extract PERSON entities .
    dimensions: ["PERSON"]
policies:
- name: AugmentedMemoizationPolicy
- name: TEDPolicy
  epochs: 40
- name: RulePolicy
  core_fallback_threshold: 0.4
  core_fallback_action_name: "action_default_fallback"
  enable_fallback_prediction: True

@nik202 I changed the Policy to this

- name: RulePolicy
- name: AugmentedMemoizationPolicy
- name: TEDPolicy
  epochs: 100
  core_fallback_threshold: 0.4
  core_fallback_action_name: "action_default_fallback"
  enable_fallback_prediction: True

moved TEDPolicy and AugmentedMemoizationPolicy from above to beneath Rule policy and increased the TEDPolicy Epoch to 100. Everything is working fine now, If someone could post a logical explanation, it would have been better.

@athulvingt Right! You are not using? Just checking.

 - name: TEDPolicy
    max_history: 5

@athulvingt Its only a matter of priority some time Policies and more the Epochs better will be the result and even some times examples also play a vital role. If you change the value of epochs again, it can again throw you an error. Do check that also :wink:

can you give me a short explanation on max_history, how the value influences a prediction

@athulvingt Sure!

max_history : This parameter controls how much dialogue history the model looks at to decide which action to take next . Default max_history for this policy is None , which means that the complete dialogue history since session restart is taken into account.

If you want to limit the model to only see a certain number of previous dialogue turns, you can set max_history to a finite value. Please note that you should pick max_history carefully, so that the model has enough previous dialogue turns to create a correct prediction.

Summary: It’s store the dialogue history

@athulvingt Please close this thread :slight_smile: Good Luck!

@nik202 one other doubt, right now

 core_fallback_threshold: 0.4
 core_fallback_action_name: "action_default_fallback"
 enable_fallback_prediction: True

is inside the TEDpolicy, is this right?

@athulvingt I’d encourage to use under RulePolicy Policies but as I said it depends much on priority and also recommended under that policy by rasa team.

thanks for your time and reply @nik202

@athulvingt Any time bro, happy learning rasa :slight_smile:

Valuable links and resources for your reference

  1. RasaMasterclass
  2. Conversational AI with Rasa
  3. Rasa for Beginners
  4. Rasa Certification Workshop
  5. Rasa Advanced Custom Actions, Forms, & Responses Workshop
  6. Rasa Advanced Deployment Workshop
  7. Rasa Youtube Channel Please subscribe and hit the bell icon for notification.
  8. Rasa Github Mini Project

I hope these links will help you to learn Rasa!