Ejemplo n.º 1
0
 def create_policy(self, featurizer, priority):
     # use standard featurizer from EmbeddingPolicy,
     # since it is using FullDialogueTrackerFeaturizer
     p = EmbeddingPolicy(priority=priority,
                         attn_before_rnn=True,
                         attn_after_rnn=True)
     return p
Ejemplo n.º 2
0
def train_dialogue_embed(domain_file="mobile_domain.yml",
                         model_path="models/dialogue_embed",
                         training_data_file="data/mobile_edit_story.md"):

    fallback = FallbackPolicy(fallback_action_name="action_default_fallback",
                              nlu_threshold=0.5,
                              core_threshold=0.3)

    agent = Agent(domain_file,
                  policies=[
                      MemoizationPolicy(max_history=5),
                      EmbeddingPolicy(epochs=100), fallback
                  ])

    training_data = agent.load_data(training_data_file)
    agent.train(training_data, validation_split=0.2)

    agent.persist(model_path)
    return agent
Ejemplo n.º 3
0
def train_dialogue(domain_file='./config/domain/domain.yml',
                   training_data_file='./config/stories/stories.md',
                   model_path='./models/dialogue'):
    fallback = FallbackPolicy(fallback_action_name="utter_default",
                              core_threshold=0.2,
                              nlu_threshold=0.1)
    agent = Agent(domain_file,
                  policies=[
                      MemoizationPolicy(),
                      KerasPolicy(), fallback,
                      FormPolicy(),
                      EmbeddingPolicy(epochs=100)
                  ])
    agent.visualize(training_data_file,
                    output_file="graph.html",
                    max_history=4)
    training_data = agent.load_data(
        training_data_file)  # augmentation_factor=0
    agent.train(training_data)
    agent.persist(model_path)
    return agent
Ejemplo n.º 4
0
 def create_policy(self, featurizer, priority):
     # use standard featurizer from EmbeddingPolicy,
     # since it is using FullDialogueTrackerFeaturizer
     p = EmbeddingPolicy(priority=priority, **tf_defaults())
     return p
Ejemplo n.º 5
0
 def create_policy(self, featurizer):
     # use standard featurizer from EmbeddingPolicy,
     # since it is using FullDialogueTrackerFeaturizer
     p = EmbeddingPolicy()
     return p
Ejemplo n.º 6
0
 def create_policy(self, featurizer):
     # use standard featurizer from EmbeddingPolicy,
     # since it is using FullDialogueTrackerFeaturizer
     p = EmbeddingPolicy(attn_before_rnn=False, attn_after_rnn=False)
     return p
Ejemplo n.º 7
0
 def create_policy(self, featurizer):
     p = EmbeddingPolicy(featurizer)
     return p