Version: 3.x
rasa.core.policies._ensemble
PolicyEnsemble Objects
class PolicyEnsemble()
check_domain_ensemble_compatibility
| @staticmethod
| check_domain_ensemble_compatibility(ensemble: Optional["PolicyEnsemble"], domain: Optional[Domain]) -> None
Check for elements that only work with certain policy/domain combinations.
persist
| persist(path: Union[Text, Path]) -> None
Persists the policy to storage.
load
| @classmethod
| load(cls, path: Union[Text, Path], new_config: Optional[Dict] = None, finetuning_epoch_fraction: float = 1.0) -> "PolicyEnsemble"
Loads policy and domain specification from disk.
get_featurizer_from_dict
| @classmethod
| get_featurizer_from_dict(cls, policy: Dict[Text, Any]) -> Tuple[Any, Any]
Gets the featurizer initializer and its arguments from a policy config.
SimplePolicyEnsemble Objects
class SimplePolicyEnsemble(PolicyEnsemble)
Default implementation of a Policy
ensemble.
is_not_in_training_data
| @staticmethod
| is_not_in_training_data(policy_name: Optional[Text], max_confidence: Optional[float] = None) -> bool
Checks if the prediction is by a policy which memoized the training data.
Arguments:
policy_name
- The name of the policy.max_confidence
- The max confidence of the policy's prediction.Returns
-True
if it's aMemoizationPolicy
,False
otherwise.
probabilities_using_best_policy
| probabilities_using_best_policy(tracker: DialogueStateTracker, domain: Domain, interpreter: NaturalLanguageInterpreter, **kwargs: Any, ,) -> PolicyPrediction
Predicts the next action the bot should take after seeing the tracker.
Picks the best policy prediction based on probabilities and policy priority.
Triggers fallback if action_listen
is predicted after a user utterance.
Arguments:
tracker
- the :class:rasa.core.trackers.DialogueStateTracker
domain
- the :class:rasa.shared.core.domain.Domain
interpreter
- Interpreter which may be used by the policies to create additional features.
Returns:
The best policy prediction.
InvalidPolicyConfig Objects
class InvalidPolicyConfig(RasaException)
Exception that can be raised when policy config is not valid.