-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfiguration.py
100 lines (77 loc) · 5.28 KB
/
configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from constants import LearningHyperParameter, LearningHyperParameter
import constants as cst
from utils.utils import noise_scheduler
class Configuration:
def __init__(self):
self.IS_WANDB = False
self.IS_SWEEP = False
self.IS_TRAINING = True
self.IS_DEBUG = False
self.IS_EVALUATION = False
self.VALIDATE_EVERY = 1
self.IS_AUGMENTATION = True
self.IS_DATA_PREPROCESSED = False
self.SPLIT_RATES = (.85, .05, .10)
self.CHOSEN_MODEL = cst.Models.TRADES
self.CHOSEN_AUGMENTER = "MLP"
self.CHOSEN_COND_AUGMENTER = "MLP"
self.SAMPLING_TYPE = "DDPM" #it can be DDPM or DDIM
self.USE_ENGINE = cst.Engine.DIFFUSION_ENGINE
if self.CHOSEN_MODEL == cst.Models.CGAN:
cst.PROJECT_NAME = "CGAN"
# select a stock
self.CHOSEN_STOCK = [cst.Stocks.TSLA]
self.WANDB_INSTANCE = None
self.WANDB_RUN_NAME = None
self.WANDB_SWEEP_NAME = None
self.IS_SHUFFLE_TRAIN_SET = True
# insert the path of the generated and real orders with a relative path
self.REAL_DATA_PATH = "ABIDES/log/paper/market_replay_INTC_2015-01-30_16-00-00/processed_orders.csv"
self.TRADES_DATA_PATH = "ABIDES/log/world_agent_INTC_2015-01-30_11-00-00_25_DDIM_0.0_1_val_ema=3.03_/processed_orders.csv"
self.IABS_DATA_PATH = "ABIDES/log/paper/IABS_INTC_20150130_110000/processed_orders.csv"
self.CGAN_DATA_PATH = "ABIDES/log/paper/world_agent_INTC_2015-01-30_11-00-00_20_val_ema=-1.05518_epoch=1_INTC_CGAN_lr_0.001_seq_size_256_seed_20/processed_orders.csv"
self.HYPER_PARAMETERS = {lp: None for lp in LearningHyperParameter}
self.HYPER_PARAMETERS[LearningHyperParameter.BATCH_SIZE] = 256
self.HYPER_PARAMETERS[LearningHyperParameter.TEST_BATCH_SIZE] = 512
self.HYPER_PARAMETERS[LearningHyperParameter.LEARNING_RATE] = 0.001
self.HYPER_PARAMETERS[LearningHyperParameter.EPOCHS] = 50
self.HYPER_PARAMETERS[LearningHyperParameter.OPTIMIZER] = cst.Optimizers.ADAM.value
self.HYPER_PARAMETERS[LearningHyperParameter.DDIM_ETA] = 0
self.HYPER_PARAMETERS[LearningHyperParameter.DDIM_NSTEPS] = 10
self.HYPER_PARAMETERS[LearningHyperParameter.SEQ_SIZE] = 256 #it's the sequencce length
self.HYPER_PARAMETERS[LearningHyperParameter.MASKED_SEQ_SIZE] = 1 #it's the number of elements to be gen, so the events that we generate at a time
self.HYPER_PARAMETERS[LearningHyperParameter.CONDITIONAL_DROPOUT] = 0.0
self.HYPER_PARAMETERS[LearningHyperParameter.DROPOUT] = 0.1
self.HYPER_PARAMETERS[LearningHyperParameter.NUM_DIFFUSIONSTEPS] = 100
self.HYPER_PARAMETERS[LearningHyperParameter.SIZE_TYPE_EMB] = 3
self.HYPER_PARAMETERS[LearningHyperParameter.SIZE_ORDER_EMB] = cst.LEN_ORDER + self.HYPER_PARAMETERS[LearningHyperParameter.SIZE_TYPE_EMB] - 1
self.HYPER_PARAMETERS[LearningHyperParameter.LAMBDA] = 0.01 #its the parameter used in the loss function to prevent L_vlb from overwhleming L_simple
self.HYPER_PARAMETERS[LearningHyperParameter.P_NORM] = 2 if self.CHOSEN_STOCK == cst.Stocks.INTC else 5
self.HYPER_PARAMETERS[LearningHyperParameter.REG_TERM_WEIGHT] = 1
self.HYPER_PARAMETERS[LearningHyperParameter.CDT_DEPTH] = 8
self.HYPER_PARAMETERS[LearningHyperParameter.CDT_MLP_RATIO] = 4
self.HYPER_PARAMETERS[LearningHyperParameter.CDT_NUM_HEADS] = 1
self.BETAS = noise_scheduler(num_diffusion_timesteps=self.HYPER_PARAMETERS[cst.LearningHyperParameter.NUM_DIFFUSIONSTEPS])
self.COND_METHOD = "concatenation" #it can be concatenation or crossattention
self.COND_TYPE = "full" # it can be full or only_event
if self.COND_TYPE == "full":
self.COND_SIZE = cst.LEN_LEVEL * cst.N_LOB_LEVELS
elif self.COND_TYPE == "only_event":
self.COND_SIZE = self.HYPER_PARAMETERS[LearningHyperParameter.SIZE_ORDER_EMB]
self.HYPER_PARAMETERS[LearningHyperParameter.AUGMENT_DIM] = 64
# generator's hyperparameters
self.HYPER_PARAMETERS[LearningHyperParameter.MARKET_FEATURES_DIM] = 9
self.HYPER_PARAMETERS[LearningHyperParameter.ORDER_FEATURES_DIM] = 7
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_LSTM_HIDDEN_STATE_DIM] = 128
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_FC_HIDDEN_DIM] = 64
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_KERNEL_SIZE] = 4
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_NUM_FC_LAYERS] = 1
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_STRIDE] = 2
self.HYPER_PARAMETERS[LearningHyperParameter.GENERATOR_CHANNELS] = [2, 32, 16, 1]
# discriminator's hyperparameters
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_LSTM_HIDDEN_STATE_DIM] = 128
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_FC_HIDDEN_DIM] = 64
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_NUM_FC_LAYERS] = 1
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_KERNEL_SIZE] = 4
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_STRIDE] = 2
self.HYPER_PARAMETERS[LearningHyperParameter.DISCRIMINATOR_CHANNELS] = [1, 32, 16, 1]