Ejemplo n.º 1
0
def run_trial_test(spec_file, spec_name=False):
    spec = spec_util.get(spec_file, spec_name)
    spec = spec_util.override_test_spec(spec)
    spec_util.tick(spec, 'trial')
    trial = Trial(spec)
    trial_metrics = trial.run()
    assert isinstance(trial_metrics, dict)
Ejemplo n.º 2
0
def run_trial_test(spec_file, spec_name=False):
    spec = spec_util.get(spec_file, spec_name)
    spec = util.override_test_spec(spec)
    info_space = InfoSpace()
    info_space.tick('trial')
    trial = Trial(spec, info_space)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 3
0
def run_trial_test(spec_file, spec_name=False, distributed=False):
    spec = spec_util.get(spec_file, spec_name)
    spec = util.override_test_spec(spec)
    info_space = InfoSpace()
    info_space.tick('trial')
    if distributed:
        spec['meta']['distributed'] = True
        if os.environ.get('CI') != 'true':  # CI has not enough CPU
            spec['meta']['max_session'] = 2
    trial = Trial(spec, info_space)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 4
0
def generic_algo_test(spec, algo_name):
    '''Need new InfoSpace() per trial otherwise session id doesn't tick correctly'''
    trial = Trial(spec, info_space=InfoSpace())
    trial_data = trial.run()
    folders = [x for x in os.listdir('data/') if x.startswith(algo_name)]
    assert len(folders) == 1
    path = 'data/' + folders[0]
    sess_data = util.read(path + '/' + algo_name + '_t0_s0_session_df.csv')
    rewards = sess_data['0.2'].replace("reward", -1).astype(float)
    print(f'rewards: {rewards}')
    maxr = rewards.max()
    '''Delete test data folder and trial'''
    shutil.rmtree(path)
    del trial
    return maxr
Ejemplo n.º 5
0
def test_algo(spec_file, spec_name):
    spec = spec_util.get(spec_file, spec_name)
    spec = util.override_test_spec(spec)
    trial = Trial(spec)
    trial_data = trial.run()
Ejemplo n.º 6
0
def run_trial_test(spec_file, spec_name):
    spec = spec_util.get(spec_file, spec_name)
    spec = util.override_test_spec(spec)
    trial = Trial(spec)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 7
0
def test_base(spec_file, spec_name):
    spec = spec_util.get(spec_file, spec_name)
    spec['meta']['train_mode'] = True
    trial = Trial(spec)
    trial_data = trial.run()
Ejemplo n.º 8
0
def run_trial_test(spec_file, spec_name):
    spec = spec_util.get(spec_file, spec_name)
    spec = util.override_test_spec(spec)
    trial = Trial(spec)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 9
0
def test_trial(test_spec):
    trial = Trial(test_spec)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 10
0
def test_trial(test_spec):
    spec_util.tick(test_spec, 'trial')
    spec_util.save(test_spec, unit='trial')
    trial = Trial(test_spec)
    trial_metrics = trial.run()
    assert isinstance(trial_metrics, dict)
Ejemplo n.º 11
0
def test_trial(test_spec, test_info_space):
    test_info_space.tick('trial')
    trial = Trial(test_spec, test_info_space)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 12
0
def test_trial(test_spec):
    trial = Trial(test_spec)
    trial_data = trial.run()
    # TODO trial data checker method
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 13
0
def test_trial(test_spec):
    trial = Trial(test_spec)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)
Ejemplo n.º 14
0
def test_trial(test_spec, test_info_space):
    test_info_space.tick('trial')
    analysis.save_spec(test_spec, test_info_space, unit='trial')
    trial = Trial(test_spec, test_info_space)
    trial_data = trial.run()
    assert isinstance(trial_data, pd.DataFrame)