rasa/core/policies/memoization.py
def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        """Predicts the next action the bot should take
            after seeing the tracker.

            Returns the list of probabilities for the next actions.
            If memorized action was found returns 1.1 for its index,
            else returns 0.0 for all actions."""
        result = [0.0] * domain.num_actions

        if not self.is_enabled:
            return result

        tracker_as_states = self.featurizer.prediction_states(
            [tracker], domain)
        states = tracker_as_states[0]
        logger.debug("Current tracker state {}".format(states))
        recalled = self.recall(states, tracker, domain)
        if recalled is not None:
            logger.debug("There is a memorised next action '{}'"
                         "".format(recalled))

            if self.USE_NLU_CONFIDENCE_AS_SCORE:
                # the memoization will use the confidence of NLU on the latest
                # user message to set the confidence of the action
                score = tracker.latest_message.intent.get("confidence", 1.0)
            else:
                score = 1.0

            result[recalled] = score
        else:
            logger.debug("There is no memorised next action")

        return result
Predicts the next action the bot should take
            after seeing the tracker.

            Returns the list of probabilities for the next actions.
            If memorized action was found returns 1.1 for its index,
            else returns 0.0 for all actions.
Predicts the next action the bot should take
after seeing the tracker.

Returns the list of probabilities for the next actions.
If memorized action was found returns 1.1 for its index,
else returns 0.0 for all actions.
Predicts the next action the bot should take after seeing the tracker . Returns the list of probabilities for the next actions . If memorized action was found returns 1 . 1 for its index else returns 0 . 0 for all actions .
def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        result = [0.0] * domain.num_actions
        if not self.is_enabled:
            return result
        tracker_as_states = self.featurizer.prediction_states(
            [tracker], domain)
        states = tracker_as_states[0]
        logger.debug("Current tracker state {}".format(states))
        recalled = self.recall(states, tracker, domain)
        if recalled is not None:
            logger.debug("There is a memorised next action '{}'"
                         "".format(recalled))
            if self.USE_NLU_CONFIDENCE_AS_SCORE:
                score = tracker.latest_message.intent.get("confidence", 1.0)
            else:
                score = 1.0
            result[recalled] = score
        else:
            logger.debug("There is no memorised next action")
        return result
def predict_action_probabilities ( self , tracker : DialogueStateTracker , domain : Domain ) -> List [ float ] : result = [ 0.0 ] * domain . num_actions if not self . is_enabled : return result tracker_as_states = self . featurizer . prediction_states ( [ tracker ] , domain ) states = tracker_as_states [ 0 ] logger . debug ( "Current tracker state {}" . format ( states ) ) recalled = self . recall ( states , tracker , domain ) if recalled is not None : logger . debug ( "There is a memorised next action '{}'" "" . format ( recalled ) ) if self . USE_NLU_CONFIDENCE_AS_SCORE : score = tracker . latest_message . intent . get ( "confidence" , 1.0 ) else : score = 1.0 result [ recalled ] = score else : logger . debug ( "There is no memorised next action" ) return result
Predicts the next action the bot should take
after seeing the tracker.
Predicts the next action the bot should take after seeing the tracker .
"""Predicts the next action the bot should take
            after seeing the tracker.

            Returns the list of probabilities for the next actions.
            If memorized action was found returns 1.1 for its index,
            else returns 0.0 for all actions.""" # the memoization will use the confidence of NLU on the latest # user message to set the confidence of the action
self
tracker
DialogueStateTracker
domain
Domain