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

        Return the list of probabilities for the next actions.
        """

        if self.session is None:
            logger.error("There is no trained tf.session: "
                         "component is either not trained or "
                         "didn't receive enough training data")
            return [0.0] * domain.num_actions

        # noinspection PyPep8Naming
        data_X = self.featurizer.create_X([tracker], domain)
        session_data = self._create_tf_session_data(domain, data_X)
        # noinspection PyPep8Naming
        all_Y_d_x = np.stack([session_data.all_Y_d
                              for _ in range(session_data.X.shape[0])])

        _sim = self.session.run(
            self.sim_op,
            feed_dict={
                self.a_in: session_data.X,
                self.b_in: all_Y_d_x,
                self.c_in: session_data.slots,
                self.b_prev_in: session_data.previous_actions,
                self._dialogue_len: session_data.X.shape[1],
                self._x_for_no_intent_in:
                    session_data.x_for_no_intent,
                self._y_for_no_action_in:
                    session_data.y_for_no_action,
                self._y_for_action_listen_in:
                    session_data.y_for_action_listen
            }
        )

        result = _sim[0, -1, :]
        if self.similarity_type == 'cosine':
            # clip negative values to zero
            result[result < 0] = 0
        elif self.similarity_type == 'inner':
            # normalize result to [0, 1] with softmax
            result = np.exp(result)
            result /= np.sum(result)

        return result.tolist()
Predict the next action the bot should take.

        Return the list of probabilities for the next actions.
        
Predict the next action the bot should take.
Return the list of probabilities for the next actions.
Predict the next action the bot should take . Return the list of probabilities for the next actions .
def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        if self.session is None:
            logger.error("There is no trained tf.session: "
                         "component is either not trained or "
                         "didn't receive enough training data")
            return [0.0] * domain.num_actions
        data_X = self.featurizer.create_X([tracker], domain)
        session_data = self._create_tf_session_data(domain, data_X)
        all_Y_d_x = np.stack([session_data.all_Y_d
                              for _ in range(session_data.X.shape[0])])
        _sim = self.session.run(
            self.sim_op,
            feed_dict={
                self.a_in: session_data.X,
                self.b_in: all_Y_d_x,
                self.c_in: session_data.slots,
                self.b_prev_in: session_data.previous_actions,
                self._dialogue_len: session_data.X.shape[1],
                self._x_for_no_intent_in:
                    session_data.x_for_no_intent,
                self._y_for_no_action_in:
                    session_data.y_for_no_action,
                self._y_for_action_listen_in:
                    session_data.y_for_action_listen
            }
        )
        result = _sim[0, -1, :]
        if self.similarity_type == 'cosine':
            result[result < 0] = 0
        elif self.similarity_type == 'inner':
            result = np.exp(result)
            result /= np.sum(result)
        return result.tolist()
def predict_action_probabilities ( self , tracker : DialogueStateTracker , domain : Domain ) -> List [ float ] : if self . session is None : logger . error ( "There is no trained tf.session: " "component is either not trained or " "didn't receive enough training data" ) return [ 0.0 ] * domain . num_actions data_X = self . featurizer . create_X ( [ tracker ] , domain ) session_data = self . _create_tf_session_data ( domain , data_X ) all_Y_d_x = np . stack ( [ session_data . all_Y_d for _ in range ( session_data . X . shape [ 0 ] ) ] ) _sim = self . session . run ( self . sim_op , feed_dict = { self . a_in : session_data . X , self . b_in : all_Y_d_x , self . c_in : session_data . slots , self . b_prev_in : session_data . previous_actions , self . _dialogue_len : session_data . X . shape [ 1 ] , self . _x_for_no_intent_in : session_data . x_for_no_intent , self . _y_for_no_action_in : session_data . y_for_no_action , self . _y_for_action_listen_in : session_data . y_for_action_listen } ) result = _sim [ 0 , - 1 , : ] if self . similarity_type == 'cosine' : result [ result < 0 ] = 0 elif self . similarity_type == 'inner' : result = np . exp ( result ) result /= np . sum ( result ) return result . tolist ( )
Predict the next action the bot should take.
Predict the next action the bot should take .
"""Predict the next action the bot should take.

        Return the list of probabilities for the next actions.
        """ # noinspection PyPep8Naming # noinspection PyPep8Naming # clip negative values to zero # normalize result to [0, 1] with softmax
self
tracker
DialogueStateTracker
domain
Domain