def settingSE8():
    d = 2
    n = 20
    T = 10000

    print("Setting 8 SE started at " + str(datetime.datetime.now()),
          flush=True)

    exp = Experiment()

    exp.initialize(timesteps=T, n_runs=n)

    #problem
    exp.add_problem('ExperimentSetting8-v0', name='VIII')

    exp.add_method('RealAR', {
        'p': 16,
        'optimizer': RealOGD(hyperparameters={'lr': 10.0})
    },
                   name='ARMA-OGD')
    exp.add_method(
        'RealAR', {
            'p': 64,
            'optimizer': RealONS(hyperparameters={
                'eps': 0.1,
                'eta': 0.1
            })
        },
        name='ARMA-ONS')
    exp.add_method('ArimaAR', {
        'p': 16,
        'd': d,
        'optimizer': RealOGD(hyperparameters={'lr': 10.0})
    },
                   name='ARIMA-OGD')
    exp.add_method(
        'ArimaAR', {
            'p': 16,
            'd': d,
            'optimizer': RealONS(hyperparameters={
                'eps': 10.0,
                'eta': 1.0
            })
        },
        name='ARIMA-ONS')

    exp.add_method('HedgeAR', {'p': 16, 'c': -1}, name='Hedge-FTRL')
    exp.add_method('HedgeARSE', {'p': 16, 'c': -1}, name='Hedge-ONS')

    print("Setting 8 SE finished at " + str(datetime.datetime.now()),
          flush=True)

    exp.scoreboard(n_digits=10)

    exp.graph(save_as=store_directory + "papersetting8SE.pdf",
              avg_regret=True,
              size=15,
              start_time=100,
              dpi=100,
              save_csv_path=store_directory + 'papersetting8SE')
def settingAE4():
    ar_dyn = np.array([0.6, -0.5, 0.4, -0.4, 0.3])
    ma_dyn = np.array([0.3, -0.2])
    mean, noise_magnitude = 0, 0.3
    d = 2
    n = 20

    T = 10000

    print("Setting ae 4 started at " + str(datetime.datetime.now()),
          flush=True)

    exp = Experiment()

    exp.initialize(metrics=['ae'], timesteps=T, n_runs=n)

    #problem
    exp.add_problem('ExperimentSetting4-v0', {
        'p': ar_dyn,
        'q': ma_dyn,
        'c': mean,
        'noise_magnitude': noise_magnitude
    },
                    name='IV')

    exp.add_method('RealAR', {
        'p': 16,
        'optimizer': RealOGD(loss=ae, hyperparameters={'lr': 0.1})
    },
                   name='ARMA-OGD')
    exp.add_method('ArimaAR', {
        'p': 16,
        'd': d,
        'optimizer': RealOGD(loss=ae, hyperparameters={'lr': 1.0})
    },
                   name='ARIMA-OGD')

    exp.add_method('HedgeAR', {
        'p': 16,
        'c': -1,
        'loss': ae
    },
                   name='Hedge-FTRL')

    print("Setting ae 4 finished at " + str(datetime.datetime.now()),
          flush=True)

    exp.scoreboard(n_digits=10, metric='ae')

    exp.graph(save_as=store_directory + "papersetting4_AE.pdf",
              avg_regret=True,
              size=15,
              start_time=100,
              metric='ae',
              dpi=100,
              save_csv_path=store_directory + 'papersetting4_AE')
def settingSE1():
    ar_dyn = np.array([0.6, -0.5, 0.4, -0.4, 0.3])
    ma_dyn = np.array([0.3, -0.2])
    mean, noise_magnitude = 0, 0.3
    n = 20
    T = 10000

    print("Setting 1 SE started at " + str(datetime.datetime.now()),
          flush=True)

    exp = Experiment()

    exp.initialize(timesteps=T, n_runs=n)

    #problem
    exp.add_problem('ARMA-v0', {
        'p': ar_dyn,
        'q': ma_dyn,
        'c': mean,
        'noise_magnitude': noise_magnitude
    },
                    name='I')

    exp.add_method(
        'RealAR', {
            'p': 8,
            'optimizer': RealONS(hyperparameters={
                'eps': 1.0,
                'eta': 1.0
            })
        },
        name='ARMA-ONS')
    exp.add_method('RealAR', {
        'p': 8,
        'optimizer': RealOGD(hyperparameters={'lr': 10})
    },
                   name='ARMA-OGD')

    exp.add_method('HedgeAR', {'p': 16, 'c': -1}, name='Hedge-FTRL')
    exp.add_method('HedgeARSE', {'p': 16, 'c': -1}, name='Hedge-ONS')

    print("Setting 1 SE finished at " + str(datetime.datetime.now()),
          flush=True)

    exp.scoreboard(n_digits=10)

    exp.graph(save_as=store_directory + "papersetting1SE.pdf",
              avg_regret=True,
              size=15,
              start_time=100,
              dpi=100,
              save_csv_path=store_directory + 'papersetting1SE')
def settingAE8():
    d = 2
    n = 20
    T = 10000

    print("Setting ae 8 started at " + str(datetime.datetime.now()),
          flush=True)

    exp = Experiment()

    exp.initialize(metrics=['ae'], timesteps=T, n_runs=n)

    #problem
    exp.add_problem('ExperimentSetting8-v0', name='VIII')

    exp.add_method('RealAR', {
        'p': 8,
        'optimizer': RealOGD(loss=ae, hyperparameters={'lr': 10.0})
    },
                   name='ARMA-OGD')
    exp.add_method('ArimaAR', {
        'p': 16,
        'd': d,
        'optimizer': RealOGD(loss=ae, hyperparameters={'lr': 0.1})
    },
                   name='ARIMA-OGD')

    exp.add_method('HedgeAR', {
        'p': 16,
        'c': -1,
        'loss': ae
    },
                   name='Hedge-FTRL')

    print("Setting ae 8 finished at " + str(datetime.datetime.now()),
          flush=True)

    exp.scoreboard(n_digits=10, metric='ae')

    exp.graph(save_as=store_directory + "papersetting8_AE.pdf",
              avg_regret=True,
              size=15,
              start_time=100,
              dpi=100,
              metric='ae',
              save_csv_path=store_directory + "papersetting8_MA")