Example #1
0
def train_nlu(data_path, configs, model_path):
    logging.basicConfig(filename=logfile, level=logging.DEBUG)
    training_data = load_data(data_path)
    trainer = Trainer(config.load(configs))
    trainer.train(training_data)
    model_directory = trainer.persist(model_path, project_name='current', fixed_model_name='nlu')
    run_evaluation(data_path, model_directory)
def evaluate_model():
	# evaluates a model and times it
	model_name = os.listdir('./tmp/models/default')[0]  # get first (and only) model
	t = time()
	evaluate.run_evaluation('data/demo_test.md', './tmp/models/default/' + model_name)
	eval_time = time() - t	
	return eval_time
Example #3
0
def _get_nlu_evaluation_loss(model_path, metric, data_path):
    logger.info("Calculating '{}' loss.".format(metric))

    evaluation_result = run_evaluation(data_path,
                                       model_path,
                                       confmat_filename=None)
    metric_result = evaluation_result['intent_evaluation'][metric]
    logger.info("{}: {}".format(metric, metric_result))

    return 1 - metric_result
def evaluate_model(td_file, model_loc):
    # evaluates the model on the training data
    # wrapper for rasa_nlu.evaluate.run_evaluation

    evaluate.run_evaluation(td_file, model_loc)
Example #5
0
def evaluate_model(td_file, model_loc):
    # evaluates the model on the training data
    # wrapper for rasa_nlu.evaluate.run_evaluation

    evaluate.run_evaluation(td_file, model_loc, intent_hist_filename='intent-hist.png')
Example #6
0
training_data = load_data("nlu.md")

# trainer to educate our pipeline
trainer = Trainer(config.load("config.yml"))

# train the model!
interpreter = trainer.train(training_data)
    
# store it for future use
model_directory = trainer.persist("./models/nlu", fixed_model_name="current")
pprint(interpreter.parse("i'm sad"))


from rasa_nlu.evaluate import run_evaluation

run_evaluation("nlu.md", model_directory)



#from IPython.display import Image
#from rasa_core.agent import Agent
#
#agent = Agent('domain.yml')
#agent.visualize("stories.md", "story_graph.png", max_history=2)
#Image(filename="story_graph.png")




from rasa_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy
from rasa_core.agent import Agent
Example #7
0
def evaluate_model(td_file, model_loc):
    """evaluates the model on the training data."""
    evaluate.run_evaluation(td_file, model_loc)