Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
36b6c8b
Data: Split lengths changed. File names changed.
rahulkfernandes Feb 26, 2026
c697b05
Feat: Early stopping implemented
rahulkfernandes Feb 27, 2026
253c394
Hyper: Best manual hparams for attentionLSTM.
rahulkfernandes Feb 27, 2026
6ca9d06
Hyper: best attention-lstm hparams for now
rahulkfernandes Feb 27, 2026
ad13d58
LR scheduler implmented
rahulkfernandes Feb 28, 2026
6f35e47
Fix: LR scheduler added to train one mode
rahulkfernandes Feb 28, 2026
5f5fbbe
Feat: Custom_loss_10, best for not, new hyper
rahulkfernandes Feb 28, 2026
142da63
Hyper: dropout increased
rahulkfernandes Feb 28, 2026
64b25b2
Feat: Saves summary of validation sharpes and returns, tqdm loop
rahulkfernandes Feb 28, 2026
5f32ecc
Hyper: Batch size reduced to 64
rahulkfernandes Feb 28, 2026
f0b52f6
Model: TFT implemented
rahulkfernandes Feb 28, 2026
0eed503
Hyper: Improved AttentionLSTM hparams, bets for now
rahulkfernandes Mar 1, 2026
8551a45
Model: Better TFT implentation added, LiteTFT -> TemporalTransformerE…
rahulkfernandes Mar 1, 2026
09d1008
Model: LSTMTransformer implemented
rahulkfernandes Mar 1, 2026
15e4632
Fix: _train_one_helper bug fixed. global seed bug fixed
rahulkfernandes Mar 1, 2026
4f3b1aa
Refactor: layers directory separated
rahulkfernandes Mar 1, 2026
8d304f6
Model: Inverterted AttentionLSTM implmented
rahulkfernandes Mar 1, 2026
b8d68df
Model: SOTA Defomr time added (copied code), needs refactor
rahulkfernandes Mar 1, 2026
cf2f495
Refactor: Seed added to hparams config
rahulkfernandes Mar 1, 2026
d812635
Refactor: DeformTime refactored
rahulkfernandes Mar 2, 2026
2ed2058
Fix: Imports Deform with __init__.py
rahulkfernandes Mar 2, 2026
d915e91
Hyper: LSTMTransformer tuned better, Model 2nd to AttentionLSTM
rahulkfernandes Mar 2, 2026
37ac80a
Fix DeformTime runtime configuration
Mar 2, 2026
59644fe
Fix: Deform uses CPU in grid
rahulkfernandes Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 184 additions & 20 deletions financial_loss_functions/config/hparams.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,205 @@
{
{
"seed": 50,
"rolling_windows": {
"in_size": 200,
"out_size": 50,
"in_size": 120,
"out_size": 60,
"stride": 1
},
"nn_models": {
"BaseLSTM": {
"model": {
"hidden_size": 256,
"num_layers": 2,
"hidden_size": 16,
"num_layers": 4,
"dropout": 0.2,
"equal_prior": true
"equal_prior": false
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-5
"weight_decay": 1e-2
},
"train" : {
"train_batch_size": 256,
"val_batch_size": 2,
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 100
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
},
"AttentionLSTM": {
"model": {
"hidden_size": 128,
"num_layers": 3,
"hidden_size": 16,
"num_layers": 4,
"attention_heads": 2,
"dropout": 0.2,
"equal_prior": false
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-2
},
"train": {
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
},
"TemporalTransformer": {
"model": {
"hidden_size": 16,
"num_layers": 2,
"attention_heads": 2,
"dropout": 0.2,
"equal_prior": true
"expansion_factor": 4,
"max_seq_len": 120
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-4
"weight_decay": 1e-2
},
"train": {
"train_batch_size": 256,
"val_batch_size": 2,
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.1,
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
},
"TFT": {
"model": {
"hidden_size": 16,
"num_layers": 1,
"attention_heads": 2,
"dropout": 0.4,
"expansion_factor": 2,
"max_seq_len": 120
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-2
},
"train": {
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 100
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
},
"LSTMTransformer": {
"model": {
"hidden_size": 32,
"num_layers": 2,
"attention_heads": 2,
"dropout": 0.5,
"expansion_factor": 4,
"max_seq_len": 120
},
"optimizer": {
"lr": 1e-5,
"weight_decay": 1e-3
},
"train": {
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-8
}
},
"InvertedAttentionLSTM": {
"model": {
"hidden_size": 16,
"num_layers": 4,
"attention_heads": 8,
"dropout": 0.5,
"max_seq_len": 120
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-3
},
"train": {
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
},
"DeformTime": {
"model": {
"seq_len": 120,
"e_layers": 2,
"d_layers": 2,
"d_model": 16,
"attention_heads": 4,
"kernel_size": 4,
"dropout": 0.2,
"n_reshape": 12,
"patch_len": 6,
"stride": 6
},
"optimizer": {
"lr": 1e-4,
"weight_decay": 1e-3
},
"train": {
"train_batch_size": 64,
"val_batch_size": 64,
"clip_grad_norm": 0.5,
"epochs": 200,
"early_stopping": true,
"early_stop_patience": 20,
"early_stop_min_delta": 1e-5
},
"scheduler": {
"factor": 0.5,
"patience": 10,
"min_lr": 1e-6
}
}
},
Expand Down Expand Up @@ -68,13 +228,17 @@
"lambda2": 0.1
},
"custom_loss_8" : {
"lambda1": 0.01,
"lambda2": 0.01,
"lambda3": 0.1
"log_ret_lambda": 0.01,
"cvar_lambda": 0.1,
"risk_p_lambda": 0.1
},
"custom_loss_9" : {
"lambda1": 0.01,
"lambda2": 0.1
},
"custom_loss_10" : {
"cvar_lambda": 0.1,
"risk_p_lambda": 0.1
}
},
"trad_models": {
Expand Down
6 changes: 3 additions & 3 deletions financial_loss_functions/config/paths.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"crsp_dir": ""
},
"raw_files": {
"train": "combined_predictors_train.csv",
"val": "combined_predictors_validation.csv",
"test": "combined_predictors_test.csv"
"train": "crsp_train_2019.csv",
"val": "crsp_val_2021.csv",
"test": "crsp_test_2023.csv"
},
"processed_paths": {
"returns_train": "data/processed/ret_train.csv",
Expand Down
5 changes: 4 additions & 1 deletion financial_loss_functions/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ seaborn==0.13.0
statsmodels==0.14.5
torch==2.9.1
torchvision==0.24.1
optuna==4.6.0
optuna==4.6.0
tqdm=4.67.1
einops==0.8.2
timm==1.0.25
6 changes: 5 additions & 1 deletion financial_loss_functions/scripts/run_training_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import signal
import argparse
from src.utils.io import load_path_config, load_config

# @author: Atharva Vaidya - This fallback helps in allowing unsupported MPS ops to run through CPU when DeformTime triggers them.
os.environ.setdefault('PYTORCH_ENABLE_MPS_FALLBACK', '1')

from src.training.pipeline import run_training_one_model

_interrupted = False
Expand Down Expand Up @@ -123,4 +127,4 @@ def cleanup_on_interrupt():
print(f"\nPipeline failed with error: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
sys.exit(1)
Loading