Exemple #1
0
    # subfolder for results
    file_dir = os.path.join(directory, 'compare_datasets')
    if not os.path.isdir(file_dir):
        os.mkdir(file_dir)

    logger = new_logger('main', directory=file_dir)
    logger.info('Started main with directory={0} and params={1}'.format(
        directory, params))

    # register parameters
    experiment_names = {
        'dataset_imbalance': dataset_imbalance,
    }

    # run specified programs
    for param in params:
        if param in experiment_names:
            experiment_names[param](file_dir)
        else:
            logger.warning('Parameter {0} invalid/not found.'.format(param))


if __name__ == '__main__':
    parsed_args = argument_parser.parse_args(sys.argv[1:])
    if parsed_args.out:
        main(parsed_args.out, parsed_args.params)
    else:
        main(parsed_args.params)
    exit(0)
Exemple #2
0
def test_argument_parser() -> None:
    args = argument_parser.parse_args(['-o', './', 'param0', 'param1'])
    assert os.path.isdir(args.out)
    assert 'param1' in args.params