From 764913b7d03bd1dedb989a46f3192002035e837f Mon Sep 17 00:00:00 2001 From: ShiYu <65760973+shiyu-coder@users.noreply.github.com> Date: Wed, 10 Sep 2025 21:36:27 +0800 Subject: [PATCH] Refactor dataset and backtesting logic in qlib_test.py Refactor QlibTestDataset and QlibBacktest classes for improved structure and readability. Update inference logic and main execution flow. --- finetune/qlib_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/finetune/qlib_test.py b/finetune/qlib_test.py index 29dddb3..43a2f0c 100644 --- a/finetune/qlib_test.py +++ b/finetune/qlib_test.py @@ -269,6 +269,8 @@ def generate_predictions(config: dict, test_data: dict) -> dict[str, pd.DataFram max_context=config['max_context'], pred_len=config['pred_len'], clip=config['clip'], T=config['T'], top_k=config['top_k'], top_p=config['top_p'], sample_count=config['sample_count'] ) + # you can also try this to drop the history data + # preds = preds[:, -config['pred_len']:, :] # The 'close' price is at index 3 in `feature_list` last_day_close = x[:, -1, 3].numpy() @@ -356,3 +358,4 @@ def main(): if __name__ == '__main__': main() +