def update_hyper_pars(hyper_pars, bandwidth= 0.1): v = copy.deepcopy(hyper_pars.varirate) v['meta_neurons'] = gen_candidate( v['meta_neurons'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['meta_dropout'] = gen_candidate( v['meta_dropout'] , bandwidth = bandwidth , type = '' , min_value = 0, max_value=0.99) v['meta_layer'] = gen_candidate( v['meta_layer'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['lstm1_max_len'] = gen_candidate( v['lstm1_max_len'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['lstm1_neurons'] = gen_candidate( v['lstm1_neurons'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['lstm1_dropout'] = gen_candidate( v['lstm1_dropout'] , bandwidth = bandwidth , type = '' , min_value = 0, max_value=0.99) v['lstm1_layer'] = gen_candidate( v['lstm1_layer'] , bandwidth = bandwidth , type = 'int' , min_value = 1) # v['lstm2_max_len'] = gen_candidate( v['lstm2_max_len'] , bandwidth = bandwidth , type = 'int' , min_value = 1) # v['lstm2_neurons'] = gen_candidate( v['lstm2_neurons'] , bandwidth = bandwidth , type = 'int' , min_value = 1) # v['lstm2_dropout'] = gen_candidate( v['lstm2_dropout'] , bandwidth = bandwidth , type = '' , min_value = 0, max_value=0.99) # v['lstm2_layer'] = gen_candidate( v['lstm2_layer'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['fc_neurons'] = gen_candidate( v['fc_neurons'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['fc_dropout'] = gen_candidate( v['fc_dropout'] , bandwidth = bandwidth , type = '' , min_value = 0, max_value=0.99) v['fc_layer'] = gen_candidate( v['fc_layer'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['max_words'] = gen_candidate( v['max_words'] , bandwidth = bandwidth , type = 'int' , min_value = 1) v['lr'] = gen_candidate( v['lr'] , bandwidth = bandwidth , type = '' , min_value = 0.000001) v['n_embedding'] = gen_candidate( v['n_embedding'] , bandwidth = bandwidth , type = 'int' , min_value = 1, max_value = 300) v['decay'] = gen_candidate( v['decay'] , bandwidth = bandwidth , type = '' , min_value = 0) v['w'] = gen_candidate( v['w'] , bandwidth = bandwidth , type = '' , min_value = 0) print(v) f = copy.deepcopy(hyper_pars.fixed) f['mod_id'] = str(round((time()))) return hyper_parameters(v, f)
def gen_hyper_pars_10_years(year_target, qt_target, root): x = hyper_parameters( varirate ={ 'meta_layer' : 2, 'meta_neurons' : 50, 'meta_dropout' : 0.4, 'lstm1_max_len' : 100, 'lstm1_neurons' : 80 , 'lstm1_dropout' : 0.1 , 'lstm1_layer' : 5, # 'lstm2_max_len' : 58, # 'lstm2_neurons' : 32, # 'lstm2_dropout' : 0.1, # 'lstm2_layer' : 2, 'fc_neurons' : 40, 'fc_dropout' : 0.3, 'fc_layer' : 2, 'max_words' : 10000, 'lr' : 0.002, 'n_embedding' : 150, 'decay': 0.0001, 'w': 0.3 }, fixed = get_fixed_10_years(year_target, qt_target, root) ) return x
def gen_hyper_pars(root="./"): x = hyper_parameters(varirate={ 'lstm1_max_len': 30, 'lstm1_neurons': 30, 'lstm1_dropout': 0.1, 'lstm1_layer': 5, 'fc_neurons': 30, 'fc_dropout': 0.3, 'fc_layer': 2, 'max_words': 10000, 'lr': 0.002, 'n_embedding': 150, 'decay': 0.0001, 'w': 0.3 }, fixed=get_fixed(root)) return x
def gen_hyper_pars_testing(year_target, mt_target, root): x = hyper_parameters(varirate={ 'meta_layer': 2, 'meta_neurons': 10, 'meta_dropout': 0.1, 'lstm1_max_len': 10, 'lstm1_neurons': 10, 'lstm1_dropout': 0.1, 'lstm1_layer': 2, 'fc_neurons': 10, 'fc_dropout': 0.1, 'fc_layer': 2, 'max_words': 10000, 'lr': 0.002, 'n_embedding': 150, 'decay': 0.0001, 'w': 1.2 }, fixed=get_fixed_2_years_quarterly( year_target, mt_target, root)) return x