rasa/core/train.py
async def train_comparison_models(stories,
                                  domain,
                                  output_path="",
                                  exclusion_percentages=None,
                                  policy_configs=None,
                                  runs=1,
                                  dump_stories=False,
                                  kwargs=None):
    """Train multiple models for comparison of policies"""
    from rasa.core import config

    exclusion_percentages = exclusion_percentages or []
    policy_configs = policy_configs or []

    for r in range(runs):
        logging.info("Starting run {}/{}".format(r + 1, runs))

        for i in exclusion_percentages:
            current_round = exclusion_percentages.index(i) + 1

            for policy_config in policy_configs:
                policies = config.load(policy_config)

                if len(policies) > 1:
                    raise ValueError("You can only specify one policy per "
                                     "model for comparison")

                policy_name = type(policies[0]).__name__
                output = os.path.join(output_path, 'run_' + str(r + 1),
                                      policy_name +
                                      str(current_round))

                logging.info("Starting to train {} round {}/{}"
                             " with {}% exclusion"
                             "".format(policy_name, current_round,
                                       len(exclusion_percentages), i))

                await train(
                    domain, stories, output,
                    policy_config=policy_config,
                    exclusion_percentage=i,
                    kwargs=kwargs,
                    dump_stories=dump_stories)
Train multiple models for comparison of policies
Train multiple models for comparison of policies
Train multiple models for comparison of policies
async def train_comparison_models(stories,
                                  domain,
                                  output_path="",
                                  exclusion_percentages=None,
                                  policy_configs=None,
                                  runs=1,
                                  dump_stories=False,
                                  kwargs=None):
    from rasa.core import config
    exclusion_percentages = exclusion_percentages or []
    policy_configs = policy_configs or []
    for r in range(runs):
        logging.info("Starting run {}/{}".format(r + 1, runs))
        for i in exclusion_percentages:
            current_round = exclusion_percentages.index(i) + 1
            for policy_config in policy_configs:
                policies = config.load(policy_config)
                if len(policies) > 1:
                    raise ValueError("You can only specify one policy per "
                                     "model for comparison")
                policy_name = type(policies[0]).__name__
                output = os.path.join(output_path, 'run_' + str(r + 1),
                                      policy_name +
                                      str(current_round))
                logging.info("Starting to train {} round {}/{}"
                             " with {}% exclusion"
                             "".format(policy_name, current_round,
                                       len(exclusion_percentages), i))
                await train(
                    domain, stories, output,
                    policy_config=policy_config,
                    exclusion_percentage=i,
                    kwargs=kwargs,
                    dump_stories=dump_stories)
async def train_comparison_models ( stories , domain , output_path = "" , exclusion_percentages = None , policy_configs = None , runs = 1 , dump_stories = False , kwargs = None ) : from rasa . core import config exclusion_percentages = exclusion_percentages or [ ] policy_configs = policy_configs or [ ] for r in range ( runs ) : logging . info ( "Starting run {}/{}" . format ( r + 1 , runs ) ) for i in exclusion_percentages : current_round = exclusion_percentages . index ( i ) + 1 for policy_config in policy_configs : policies = config . load ( policy_config ) if len ( policies ) > 1 : raise ValueError ( "You can only specify one policy per " "model for comparison" ) policy_name = type ( policies [ 0 ] ) . __name__ output = os . path . join ( output_path , 'run_' + str ( r + 1 ) , policy_name + str ( current_round ) ) logging . info ( "Starting to train {} round {}/{}" " with {}% exclusion" "" . format ( policy_name , current_round , len ( exclusion_percentages ) , i ) ) await train ( domain , stories , output , policy_config = policy_config , exclusion_percentage = i , kwargs = kwargs , dump_stories = dump_stories )
Train multiple models for comparison of policies
Train multiple models for comparison of policies
"""Train multiple models for comparison of policies"""
stories
domain
output_path
exclusion_percentages
policy_configs
runs
dump_stories
kwargs