def test_train_with_e2e_data(
    default_model_storage: ModelStorage,
    default_execution_context: ExecutionContext,
    tracker_events: List[List[Event]],
    skip_training: bool,
    domain: Domain,
):
    policy = UnexpecTEDIntentPolicy(
        UnexpecTEDIntentPolicy.get_default_config(),
        default_model_storage,
        Resource("UnexpecTEDIntentPolicy"),
        default_execution_context,
        featurizer=IntentMaxHistoryTrackerFeaturizer(
            IntentTokenizerSingleStateFeaturizer()
        ),
    )
    trackers_for_training = [
        TrackerWithCachedStates.from_events(
            sender_id=f"{tracker_index}", evts=events, domain=domain
        )
        for tracker_index, events in enumerate(tracker_events)
    ]
    if skip_training:
        with pytest.warns(UserWarning):
            policy.train(trackers_for_training, domain, precomputations=None)
    else:
        policy.train(trackers_for_training, domain, precomputations=None)
Example #2
0
 def _standard_featurizer(self) -> TrackerFeaturizer:
     return IntentMaxHistoryTrackerFeaturizer(
         IntentTokenizerSingleStateFeaturizer(),
         max_history=self.config.get(POLICY_MAX_HISTORY),
     )
 def featurizer(self) -> TrackerFeaturizer:
     featurizer = IntentMaxHistoryTrackerFeaturizer(
         IntentTokenizerSingleStateFeaturizer(), max_history=self.max_history
     )
     return featurizer
 def _standard_featurizer(
         max_history: Optional[int] = None) -> TrackerFeaturizer:
     return IntentMaxHistoryTrackerFeaturizer(
         IntentTokenizerSingleStateFeaturizer(), max_history=max_history)