How to change the rasa policy from default to EmbeddingPolicy

agent = Agent(‘domain.yml’, policies=[MemoizationPolicy(max_history=4), EmbeddingPolicy()]

I am unable to use --config config,.yml

  - name: "KerasPolicy"
    - name: MaxHistoryTrackerFeaturizer
      max_history: 5
        - name: BinarySingleStateFeaturizer
  - name: "MemoizationPolicy"
    max_history: 5
  - name: "FallbackPolicy"
    nlu_threshold: 0.4
    core_threshold: 0.3
    fallback_action_name: "my_fallback_action"
  - name: ""
    arg1: "..."

Do I have to write custom code to implent this ?

I can find this ?

what are the other types of polices ?? Is there any help ?

Hi @azizullah2017,

there’s a brief demo of the policy available on GitHub here

If, in the meantime, you already managed to implement it on your own, please feel free to share your version of it :wink:

@smn-snkl thanks for reply.

  - name: EmbeddingPolicy
    epochs: 2000
    attn_shift_range: 5
  - name: FormPolicy 

but i do not get the desired result from this.

  - name: EmbeddingPolicy
    epochs: 40
    state_featurizer: LabelTokenizerSingleStateFeaturizer
  - name: KerasPolicy
    - name: MaxHistoryTrackerFeaturizer
      max_history: 10
        - name: BinarySingleStateFeaturizer
    epochs: 200
  - name: FormPolicy

@azizullah2017 this has worked for me in the past:

  - name: "EmbeddingPolicy"
    epochs: 1000
    attn_shift_range: 3
    - name: FullDialogueTrackerFeaturizer
      - name: LabelTokenizerSingleStateFeaturizer

2000 is too much, it will take alot of time for training.

@azizullah2017 Forgot one important detail. You should set augmentation to 0 for training an embedding policy! Just takes a few seconds for me then.

Follow this thread for (hopefully) more updates on this

@smn-snkl thanks now it takes much less time, can you to tell me, any advantages of this, Because i get the same results from both policies. the embadding and the keras

There’s a blog post about it here: Attention, Dialogue, and Learning Reusable Patterns

It doesn’t necessarily outperform keras. You could use the evaluation functionality to test which set of policies perform best. Always a good idea to “cross-validate” your policies as well, since there’s no optimal solution for how you should set all the hyperparameters.

Could you get FormPolicy to work with EmbeddingPolicy? I couldn’t. It will raise an error ruamel.yaml.scanner.ScannerError: mapping values are not allowed in this context But when I put FormPolicy and KerasPolicy together, it trains without error.

@imadcat: It seems you have a syntax error in your config. Can you run it through a YAML validator?

I wonder how to set epochs?what rules or reference?