def main(gt_test, gt_val, train_set, test_set, data_name,
         output_dir, n_jobs, n_trails):
    os.makedirs(output_dir, exist_ok=False)
    cl_args = [
        '--gt-test', gt_test,
        '--gt-val', gt_val,
        '--train-sets', train_set,
        '--test-set', test_set,
    ]
    results = fmin(train_decoder,
                   random_aug_space(cl_args, output_dir, data_name),
                   n=n_trails, n_jobs=n_jobs)
    mhd, (config, base_output_dir, _) = results[0]
    print("Min MHD: {}".format(mhd))
    print("with config:")
    pprint(config)

    with open(os.path.join(output_dir, "results.json"), 'w') as f:
        json.dump(results, f)
def main(gt_test, gt_val, train_set, test_set, data_name, output_dir, n_jobs,
         n_trails):
    os.makedirs(output_dir, exist_ok=False)
    cl_args = [
        '--gt-test',
        gt_test,
        '--gt-val',
        gt_val,
        '--train-sets',
        train_set,
        '--test-set',
        test_set,
    ]
    results = fmin(train_decoder,
                   random_aug_space(cl_args, output_dir, data_name),
                   n=n_trails,
                   n_jobs=n_jobs)
    mhd, (config, base_output_dir, _) = results[0]
    print("Min MHD: {}".format(mhd))
    print("with config:")
    pprint(config)

    with open(os.path.join(output_dir, "results.json"), 'w') as f:
        json.dump(results, f)
def test_fmin():
    results = fmin(quadratic_function, space_function, n=50, verbose=1)
    val, space = results[0]
    print(val, space)
    assert val <= 0.1