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 settingSE6(): T = 100 print("Setting SP500 SE started at " + str(datetime.datetime.now()), flush=True) exp = Experiment() exp.initialize(timesteps=T, n_runs=5) exp.add_problem('ExperimentSetting6-v0', name='VI') val = [8, 16, 32, 64] hp = [10, 1, 0.1, 0.01, 0.001, 0.0001] for p in val: print("setting SP500 SE p = " + str(p) + " started.", flush=True) for lr in hp: exp.add_method('AutoRegressor', { 'p': p, 'optimizer': RealOGD(hyperparameters={'lr': lr}) }, name='ArmaOGD_{0:2d}_{1:2.4f}'.format(p, lr)) exp.add_method('ArimaAR', { 'p': p, 'd': 2, 'optimizer': RealOGD(hyperparameters={'lr': lr}) }, name='ArimaOGD_{0:2d}_{1:2.4f}'.format(p, lr)) for eps in hp: for eta in hp: exp.add_method('AutoRegressor', { 'p': p, 'optimizer': RealONS(hyperparameters={ 'eps': eps, 'eta': eta }) }, name='ArmaONS_{0:2d}_{1:2.4f}_{2:2.4f}'.format( p, eps, eta)) exp.add_method('ArimaAR', { 'p': p, 'd': 2, 'optimizer': RealONS(hyperparameters={ 'eps': eps, 'eta': eta }) }, name='ArimaONS_{0:2d}_{1:2.4f}_{2:2.4f}'.format( p, eps, eta)) print("Setting SP500 SE tuned at " + str(datetime.datetime.now()), flush=True) exp.scoreboard(n_digits=10)
def settingSE2(): T = 100 hp1 = np.array([10, 1, 0.1, 0.01, 0.001, 0.0001]) hp2 = np.array([10, 1, 0.1, 0.01, 0.001, 0.0001]) print("Setting 2 SE started at " + str(datetime.datetime.now()), flush=True) exp = Experiment() exp.initialize(timesteps=T, n_runs=5) exp.add_problem('ExperimentSetting2-v0', {}, name='II') val = [8, 16, 32, 64] for p in val: print("setting 2 SE p = " + str(p) + " started.", flush=True) for lr in hp1: param = {'lr': lr} exp.add_method('RealAR', { 'p': p, 'optimizer': RealOGD(hyperparameters=param) }, name='OGD_{0}'.format(lr)) for eta in hp1: for eps in hp2: param = {'eps': eps, 'eta': eta} exp.add_method('RealAR', { 'p': p, 'optimizer': RealONS(hyperparameters=param) }, name='ONS_{0}_{1}'.format(eta, eps)) print("Setting 2 SE tuned at " + str(datetime.datetime.now()), flush=True) exp.scoreboard(n_digits=10)
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 settingSE1(): T = 100 p = 10 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 hp1 = np.array([10, 1, 0.1, 0.01, 0.001, 0.0001]) hp2 = np.array([10, 1, 0.1, 0.01, 0.001, 0.0001]) print("Setting 1 SE started at " + str(datetime.datetime.now()), flush=True) exp = Experiment() exp.initialize(timesteps=T, n_runs=5) exp.add_problem('ARMA-v0', { 'p': ar_dyn, 'q': ma_dyn, 'c': mean, 'noise_magnitude': noise_magnitude }, name='I') val = [8, 16, 32, 64] for p in val: print("setting 1 SE p = " + str(p) + " started.", flush=True) for lr in hp1: param = {'lr': lr} exp.add_method('RealAR', { 'p': p, 'optimizer': RealOGD(hyperparameters=param) }, name='OGD_{0}'.format(lr)) for eta in hp1: for eps in hp2: param = {'eps': eps, 'eta': eta} exp.add_method('RealAR', { 'p': p, 'optimizer': RealONS(hyperparameters=param) }, name='ONS_{0}_{1}'.format(eta, eps)) print("Setting 1 SE tuned at " + str(datetime.datetime.now()), flush=True) exp.scoreboard(n_digits=10)