-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain_initialize.py
31 lines (24 loc) · 935 Bytes
/
train_initialize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy
from rasa_core.policies.sklearn_policy import SklearnPolicy
if __name__ == '__main__':
utils.configure_colored_logging(loglevel="DEBUG")
training_data_file = './data/stories.md'
model_path = './models/dialogue'
agent = Agent("horoscope_domain.yml",
policies=[MemoizationPolicy(max_history = 2), KerasPolicy()])
training_data = agent.load_data(training_data_file)
agent.train(
training_data,
augmentation_factor=50,
epochs=500,
batch_size=10,
validation_split=0.2
)
agent.persist(model_path)