Understanding the usage of LSTM in keras_policy

Need help from experts here @souvikg10 @Juste

I am trying to understand how the dialogue management actually works at Rasa core. I am well aware of the high-level architecture but interested to understand how LSTM is used. So I am looking into the keras_policy.py file

I am a bit confused about some of the logic in model_architecture method. I see you have if-else based on the length of the output shape len(output_shape). Although it is well commented that the target label y can be either (num examples, num features) or (num examples, max_dialogue_len, num features), I am not sure why.

Can anyone please explain?

1 Like

Depending on the TrackerFeaturizer, we use LSTM output differently:

  • if you use MaxHistoryTrackerFeaturizer (default), only the last output is used to predict next action, and therefore only last output is used to calculate the loss
  • if you use FullDialogueTrackerFeaturizer, output at each time is used to predict next actions, so we need additional time distributed layer to calculate the loss
1 Like