Ejemplo n.º 1
0
##############################################################################
# Main function

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Run batch experiment')
    parser.add_argument('--config', help='config', type=str)
    parser.add_argument('--job_id', help='job_id', type=int)
    parser.add_argument('--save_path', help='save_path', type=str)
    settings = parser.parse_args()

    # Loading in the experiment config.
    experiment_config = importlib.import_module(settings.config)
    config = experiment_config.get_config()

    # Running the experiment.
    job_config = config_lib.get_job_config(config, settings.job_id)
    experiment = job_config['experiment']
    experiment.run_experiment()

    # Saving results to csv.
    file_name = ('exp=' + config.name + '|id=' + str(settings.job_id) + '.csv')
    file_path = os.path.join(settings.save_path, file_name)
    with open(file_path, 'w') as f:
        experiment.results.to_csv(f, index=False)

    # Save the parameters if it is the first job.
    if settings.job_id == 0:
        params_df = config_lib.get_params_df(config)
        file_name = 'exp=' + config.name + '|params.csv'
        file_path = os.path.join(settings.save_path, file_name)
        with open(file_path, 'w') as f:
Ejemplo n.º 2
0
CONFIG_PATH = 'al.config_rl_ac'
N_JOBS = 10

#############################################################################
# Running from a local config file
sys.path.append(os.getcwd())

# Loading in the experiment config file
config_module = importlib.import_module(CONFIG_PATH)
config = config_module.get_config()

results = []
for job_id in range(N_JOBS):
    # Running the experiment.
    job_config = config_lib.get_job_config(config, job_id)
    experiment = job_config['experiment']
    experiment.run_experiment()
    results.append(experiment.results)


def lower_interval(x):
    return np.mean(x) - 2 * np.std(x)


def upper_interval(x):
    return np.mean(x) + 2 * np.std(x)


#############################################################################
# Collating data with Pandas
Ejemplo n.º 3
0
##############################################################################
# Main function

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Run batch experiment')
    parser.add_argument('--config', help='config', type=str)
    parser.add_argument('--job_id', help='job_id', type=int)
    parser.add_argument('--save_path', help='save_path', type=str)
    args = parser.parse_args()

    # Loading in the experiment config.
    experiment_config = importlib.import_module(args.config)
    config = experiment_config.get_config()

    # Running the experiment.
    job_config = config_lib.get_job_config(config, args.job_id)
    experiment = job_config['experiment']
    experiment.run_experiment()

    # Saving results to csv.
    file_name = ('exp=' + config.name + '|id=' + str(args.job_id) + '.csv')
    file_path = os.path.join(args.save_path, file_name)
    with open(file_path, 'w') as f:
        experiment.results.to_csv(f, index=False)

    # Save the parameters if it is the first job.
    if args.job_id == 0:
        params_df = config_lib.get_params_df(config)
        file_name = 'exp=' + config.name + '|params.csv'
        file_path = os.path.join(args.save_path, file_name)
        with open(file_path, 'w') as f: