diff --git a/configs/evaluations/informer-btcusdt-15m-rmse.yaml b/configs/evaluations/informer-btcusdt-15m-rmse.yaml new file mode 100644 index 0000000..72be3af --- /dev/null +++ b/configs/evaluations/informer-btcusdt-15m-rmse.yaml @@ -0,0 +1,25 @@ +program: ./scripts/train.py +name: informer-btcusdt-15m-rmse-eval +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-15m-rmse.yaml" + - "--patience" + - "20" + - "--store-predictions" +method: grid +metric: + goal: minimize + name: val_loss +parameters: + data: + parameters: + dataset: + value: "btc-usdt-15m:latest" + validation: + value: 0.2 + sliding_window: + min: 0 + max: 5 diff --git a/configs/evaluations/informer-btcusdt-30m-rmse.yaml b/configs/evaluations/informer-btcusdt-30m-rmse.yaml new file mode 100644 index 0000000..af7f370 --- /dev/null +++ b/configs/evaluations/informer-btcusdt-30m-rmse.yaml @@ -0,0 +1,27 @@ +program: ./scripts/train.py +name: informer-btcusdt-30m-rmse-eval +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-30m-rmse.yaml" + - "--patience" + - "20" + - "--store-predictions" + - "--val-check-interval" + - "100" +method: grid +metric: + goal: minimize + name: val_loss +parameters: + data: + parameters: + dataset: + value: "btc-usdt-30m:latest" + validation: + value: 0.2 + sliding_window: + min: 0 + max: 5 diff --git a/configs/evaluations/informer-btcusdt-5m-rmse.yaml b/configs/evaluations/informer-btcusdt-5m-rmse.yaml new file mode 100644 index 0000000..47ee44c --- /dev/null +++ b/configs/evaluations/informer-btcusdt-5m-rmse.yaml @@ -0,0 +1,25 @@ +program: ./scripts/train.py +name: informer-btcusdt-5m-rmse-eval +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-5m-rmse.yaml" + - "--patience" + - "20" + - "--store-predictions" +method: grid +metric: + goal: minimize + name: val_loss +parameters: + data: + parameters: + dataset: + value: "btc-usdt-5m:latest" + validation: + value: 0.2 + sliding_window: + min: 0 + max: 5 diff --git a/configs/experiments/informer-btcusdt-15m-rmse.yaml b/configs/experiments/informer-btcusdt-15m-rmse.yaml new file mode 100644 index 0000000..c4edf03 --- /dev/null +++ b/configs/experiments/informer-btcusdt-15m-rmse.yaml @@ -0,0 +1,68 @@ +future_window: + value: 2 +past_window: + value: 110 +batch_size: + value: 64 +max_epochs: + value: 30 +data: + value: + dataset: "btc-usdt-15m:latest" + sliding_window: 0 + validation: 0.2 +fields: + value: + time_index: "time_index" + target: "returns" + group_ids: ["group_id"] + dynamic_unknown_real: + - "high_price" + - "low_price" + - "open_price" + - "close_price" + - "volume" + - "open_to_close_price" + - "high_to_close_price" + - "low_to_close_price" + - "high_to_low_price" + - "returns" + - "log_returns" + - "vol_1h" + - "macd" + - "macd_signal" + - "rsi" + - "low_bband_to_close_price" + - "up_bband_to_close_price" + - "mid_bband_to_close_price" + - "sma_1h_to_close_price" + - "sma_1d_to_close_price" + - "sma_7d_to_close_price" + - "ema_1h_to_close_price" + - "ema_1d_to_close_price" + dynamic_unknown_cat: [] + dynamic_known_real: + - "effective_rates" + - "vix_close_price" + - "fear_greed_index" + - "vol_1d" + - "vol_7d" + dynamic_known_cat: + - "hour" + - "weekday" + static_real: [] + static_cat: [] +loss: + value: + name: "RMSE" +model: + value: + name: "Informer" + d_model: 512 + d_fully_connected: 256 + n_attention_heads: 4 + dropout: 0.1 + n_encoder_layers: 3 + n_decoder_layers: 2 + learning_rate: 0.0005 + optimizer: "Adam" diff --git a/configs/experiments/informer-btcusdt-30m-rmse.yaml b/configs/experiments/informer-btcusdt-30m-rmse.yaml new file mode 100644 index 0000000..96c6cec --- /dev/null +++ b/configs/experiments/informer-btcusdt-30m-rmse.yaml @@ -0,0 +1,68 @@ +future_window: + value: 2 +past_window: + value: 115 +batch_size: + value: 64 +max_epochs: + value: 50 +data: + value: + dataset: "btc-usdt-30m:latest" + sliding_window: 0 + validation: 0.2 +fields: + value: + time_index: "time_index" + target: "returns" + group_ids: ["group_id"] + dynamic_unknown_real: + - "high_price" + - "low_price" + - "open_price" + - "close_price" + - "volume" + - "open_to_close_price" + - "high_to_close_price" + - "low_to_close_price" + - "high_to_low_price" + - "returns" + - "log_returns" + - "vol_1h" + - "macd" + - "macd_signal" + - "rsi" + - "low_bband_to_close_price" + - "up_bband_to_close_price" + - "mid_bband_to_close_price" + - "sma_1h_to_close_price" + - "sma_1d_to_close_price" + - "sma_7d_to_close_price" + - "ema_1h_to_close_price" + - "ema_1d_to_close_price" + dynamic_unknown_cat: [] + dynamic_known_real: + - "effective_rates" + - "vix_close_price" + - "fear_greed_index" + - "vol_1d" + - "vol_7d" + dynamic_known_cat: + - "hour" + - "weekday" + static_real: [] + static_cat: [] +loss: + value: + name: "RMSE" +model: + value: + name: "Informer" + d_model: 256 + d_fully_connected: 512 + n_attention_heads: 2 + dropout: 0.2 + n_encoder_layers: 2 + n_decoder_layers: 2 + learning_rate: 0.0005 + optimizer: "Adam" diff --git a/configs/experiments/informer-btcusdt-5m-rmse.yaml b/configs/experiments/informer-btcusdt-5m-rmse.yaml new file mode 100644 index 0000000..59cfb9b --- /dev/null +++ b/configs/experiments/informer-btcusdt-5m-rmse.yaml @@ -0,0 +1,68 @@ +future_window: + value: 2 +past_window: + value: 102 +batch_size: + value: 64 +max_epochs: + value: 30 +data: + value: + dataset: "btc-usdt-5m:latest" + sliding_window: 0 + validation: 0.2 +fields: + value: + time_index: "time_index" + target: "returns" + group_ids: ["group_id"] + dynamic_unknown_real: + - "high_price" + - "low_price" + - "open_price" + - "close_price" + - "volume" + - "open_to_close_price" + - "high_to_close_price" + - "low_to_close_price" + - "high_to_low_price" + - "returns" + - "log_returns" + - "vol_1h" + - "macd" + - "macd_signal" + - "rsi" + - "low_bband_to_close_price" + - "up_bband_to_close_price" + - "mid_bband_to_close_price" + - "sma_1h_to_close_price" + - "sma_1d_to_close_price" + - "sma_7d_to_close_price" + - "ema_1h_to_close_price" + - "ema_1d_to_close_price" + dynamic_unknown_cat: [] + dynamic_known_real: + - "effective_rates" + - "vix_close_price" + - "fear_greed_index" + - "vol_1d" + - "vol_7d" + dynamic_known_cat: + - "hour" + - "weekday" + static_real: [] + static_cat: [] +loss: + value: + name: "RMSE" +model: + value: + name: "Informer" + d_model: 512 + d_fully_connected: 512 + n_attention_heads: 4 + dropout: 0.3 + n_encoder_layers: 2 + n_decoder_layers: 3 + learning_rate: 0.0005 + optimizer: "Adam" diff --git a/configs/sweeps/informer-btcusdt-15m-rmse.yaml b/configs/sweeps/informer-btcusdt-15m-rmse.yaml new file mode 100644 index 0000000..947b0f2 --- /dev/null +++ b/configs/sweeps/informer-btcusdt-15m-rmse.yaml @@ -0,0 +1,41 @@ +program: ./scripts/train.py +name: informer-btcusdt-15m-rmse-sweep +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-15m-rmse.yaml" + - "--patience" + - "15" +method: random +metric: + goal: minimize + name: val_loss +parameters: + past_window: + distribution: int_uniform + min: 20 + max: 120 + batch_size: + values: [64, 128, 256] + model: + parameters: + name: + value: "Informer" + d_model: + values: [256, 512, 1024] + d_fully_connected: + values: [256, 512, 1024] + n_attention_heads: + values: [1, 2, 4] + dropout: + values: [0.05, 0.1, 0.2, 0.3] + n_encoder_layers: + values: [1, 2, 3] + n_decoder_layers: + values: [1, 2, 3] + learning_rate: + values: [0.001, 0.0005, 0.0001] + optimizer: + value: "Adam" \ No newline at end of file diff --git a/configs/sweeps/informer-btcusdt-30m-rmse.yaml b/configs/sweeps/informer-btcusdt-30m-rmse.yaml new file mode 100644 index 0000000..f00b8b1 --- /dev/null +++ b/configs/sweeps/informer-btcusdt-30m-rmse.yaml @@ -0,0 +1,43 @@ +program: ./scripts/train.py +name: informer-btcusdt-30m-rmse-sweep +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-30m-rmse.yaml" + - "--patience" + - "15" + - "--val-check-interval" + - "100" +method: random +metric: + goal: minimize + name: val_loss +parameters: + past_window: + distribution: int_uniform + min: 20 + max: 120 + batch_size: + values: [64, 128, 256] + model: + parameters: + name: + value: "Informer" + d_model: + values: [256, 512, 1024] + d_fully_connected: + values: [256, 512, 1024] + n_attention_heads: + values: [1, 2, 4] + dropout: + values: [0.05, 0.1, 0.2, 0.3] + n_encoder_layers: + values: [1, 2, 3] + n_decoder_layers: + values: [1, 2, 3] + learning_rate: + values: [0.001, 0.0005, 0.0001] + optimizer: + value: "Adam" diff --git a/configs/sweeps/informer-btcusdt-5m-rmse.yaml b/configs/sweeps/informer-btcusdt-5m-rmse.yaml new file mode 100644 index 0000000..160e1d1 --- /dev/null +++ b/configs/sweeps/informer-btcusdt-5m-rmse.yaml @@ -0,0 +1,41 @@ +program: ./scripts/train.py +name: informer-btcusdt-5m-rmse-sweep +project: wne-masters-thesis-testing +command: + - ${env} + - ${interpreter} + - ${program} + - "./configs/experiments/informer-btcusdt-5m-rmse.yaml" + - "--patience" + - "15" +method: random +metric: + goal: minimize + name: val_loss +parameters: + past_window: + distribution: int_uniform + min: 20 + max: 120 + batch_size: + values: [64, 128, 256] + model: + parameters: + name: + value: "Informer" + d_model: + values: [256, 512, 1024] + d_fully_connected: + values: [256, 512, 1024] + n_attention_heads: + values: [1, 2, 4] + dropout: + values: [0.05, 0.1, 0.2, 0.3] + n_encoder_layers: + values: [1, 2, 3] + n_decoder_layers: + values: [1, 2, 3] + learning_rate: + values: [0.001, 0.0005, 0.0001] + optimizer: + value: "Adam" \ No newline at end of file diff --git a/src/ml/loss.py b/src/ml/loss.py index e2f1942..4606898 100644 --- a/src/ml/loss.py +++ b/src/ml/loss.py @@ -1,6 +1,6 @@ import torch -from pytorch_forecasting import QuantileLoss +from pytorch_forecasting import QuantileLoss, RMSE from pytorch_forecasting.metrics.base_metrics import MultiHorizonMetric @@ -15,6 +15,9 @@ def get_loss(config): a=config['loss']['a'], b=config['loss']['b'] ) + + if loss_name == 'RMSE': + return RMSE() raise ValueError("Unknown loss")