Example #1
0
def hdp_sample_only():
    print('hdp_sample only')
    round = 800
    rand_seed = np.random.randint(0, 10000000)
    res_hdp = run_hdp(rounds=round, seed=rand_seed)
    eval_res = OneRoundEvaluation(res_list=[res_hdp])
    eval_res.plot_all()
Example #2
0
def compare_hdp_hdpsample():
    print('hdp and sample')
    round = 1000
    rand_seed = np.random.randint(0, 10000000)
    res_hdp = run_hdp(rounds=round, seed=rand_seed)
    res_hdp_sample = run_hdp_sample(rounds=round, seed=rand_seed)
    eval_res = OneRoundEvaluation(res_list=[res_hdp, res_hdp_sample])
    eval_res.plot_all()
Example #3
0
def vi_test():
    exp_round = 3
    res_list = []
    for t in range(exp_round):
        round = 800
        rand_seed = np.random.randint(0, 10000000)
        res_list.append(
            run_vi(rounds=round, seed=rand_seed, name='VI_' + str(t + 1)), )
    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #4
0
def hdp_five_times():

    print('hdp 5')
    res_list = []
    for t in range(5):
        round = 800
        rand_seed = np.random.randint(0, 10000000)
        res_list.append(
            run_hdp(rounds=round, seed=rand_seed, name='hdp_' + str(t + 1)), )
    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #5
0
def run_adhdp_only():
    round = 3200
    predict_round = 800
    res_list = []
    rand_seed = np.random.randint(0, 10000000)
    # rand_seed = 320743
    res_list.append(
        run_adhdp(rounds=round,
                  seed=rand_seed,
                  name='ADHDP',
                  predict_round=predict_round))

    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #6
0
def ADHDP_Off_Policy_only():

    round = 3200
    res_list = []
    rand_seed = np.random.randint(0, 10000000)
    # rand_seed = 320743
    res_list.append(
        run_adhdp_offpolicy(rounds=round,
                            seed=rand_seed,
                            name='ADHDP',
                            train_rounds=5,
                            train_step_in_round=200))

    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #7
0
def vi_compare_sample():
    exp_round = 1
    res_list = []
    predict_round = 800
    rand_seed = np.random.randint(0, 10000000)

    for t in range(exp_round):
        round = 800
        res_list.append(
            run_vi(rounds=round,
                   seed=rand_seed,
                   name='VI',
                   predict_round=predict_round), )

    for t in range(exp_round):
        round = 800
        res_list.append(
            run_vi_sample(rounds=round,
                          seed=rand_seed,
                          name='VI_sample',
                          predict_round=predict_round), )

    eval_res = OneRoundEvaluation(res_list=res_list)
    mse_dict = eval_res.plot_all()

    mse_vi.append(mse_dict['VI'])
    mse_vi_sample.append(mse_dict['VI_sample'])
Example #8
0
def vi_compare_hdp():
    round = 800
    predict_round = 800
    res_list = []
    rand_seed = np.random.randint(0, 10000000)
    # rand_seed = 320743
    res_list.append(
        run_vi(rounds=round,
               seed=rand_seed,
               name='VI',
               predict_round=predict_round))
    res_list.append(
        run_hdp(rounds=round,
                seed=rand_seed,
                name='HDP',
                predict_round=predict_round))
    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #9
0
def vi_diff_capacity(capacity_list=None):

    if capacity_list is None:
        capacity = range(1, 12, 3)

    predict_round = 800
    res_list = []

    rand_seed = np.random.randint(0, 10000000)
    rand_seed = 3309316
    for capacity in capacity_list:
        round = 800
        res_list.append(
            run_vi(rounds=round,
                   seed=rand_seed,
                   capacity=capacity,
                   name='Replay: ' + str(capacity),
                   predict_round=predict_round))
    eval_res = OneRoundEvaluation(res_list=res_list)
    eval_res.plot_all()
Example #10
0
def run_adhdp(rounds=1000, seed=random.randint(0, 1000000)):

    print('seed :', seed)
    random.seed(seed)
    np.random.seed(seed)
    penalty = Quadratic(**penalty_para)
    env_adhdp = Thickener(
        penalty_calculator=penalty,
        **thickner_para,
        random_seed=seed,
    )

    env_adhdp.reset()
    res1 = OneRoundExp(controller=adhdp,
                       env=env_adhdp,
                       max_step=rounds,
                       exp_name='ADHDP').run()

    eval_res = OneRoundEvaluation(res_list=[res1])
    eval_res.plot_all()
Example #11
0
def vi_optim_compare():
    exp_round = 1
    res_list = []
    predict_round = 800
    rand_seed = np.random.randint(0, 10000000)

    opt_list = ['adagrad', 'RMSprop', 'adam', 'sgd']
    opt_list = ['adam', 'sgd']
    for opt_name in opt_list:
        round = 800
        res_list.append(
            run_vi(rounds=round,
                   seed=rand_seed,
                   name='VI_' + opt_name,
                   predict_round=predict_round,
                   u_optim=opt_name), )

    eval_res = OneRoundEvaluation(res_list=res_list)
    mse_dict = eval_res.plot_all()