How rasa Core works

Hi there i Hope you are having a nice day. I m pretty new to the rasa world but it seems promising and i like but i have some Question that i couldn’t find a clear answer for them or the documentation wasn’t clear i hope you can help me with any of them :
1/what is exactly KerasPolicy how does it affect in taking the next action 2/how does rasa core predict which policy he should use next 3/what is exactly MemoizationPolicy and does it activate and how does it take the next action 4/ how Prediction Process works 5/ if a story doesnt exist in the storys why does th core is executing and detecting other action when it doesnt rassemble to the nlu response

Hey @mohamedHassanKa I’ll try to answer your questions: Also have a look here in the Docs: Training and Policies

  1. Keras Policy: The KerasPolicy uses a neural network implemented in Keras to select the next action. The default architecture is based on an LSTM. The input into the NN are featurized trackers and domain and its trained to minimize the keras categorical_crossentropy loss. Depending on the TrackerFeaturizer , we use LSTM output differently: a) 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; b) 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.

  2. How is policy chosen? At every turn, the policy which predicts the next action with the highest confidence will be used.

  3. Memoization Policy: The MemoizationPolicy just memorizes the conversations in your training data. It predicts the next action with confidence 1.0 if this exact conversation exists in the training data, otherwise it predicts None with confidence 0.0 .

  4. The prediction process works different for every policy. Please refer to the Training and Policies Docs. As mentioned above, each policy predicts a next action and returns its confidence in its prediction, the prediction with the highest confidence is chosen as next action.

  5. Not all possible stories have to exist and not all possible input has to be listed in the nlu data. We use machine learning to predict actions based on the data available instead of having a rule based dialogue system. If you want to error proof your chat bot you will have to implement Fallback Actions and intents to make sure that out of domain intents get picked up and your bot handles them appropriately.

I hope this helps!

1 Like