Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行报错求助:real_end_time = cal[end_index + self.max_future_days] IndexError: index 8246 is out of bounds for axis 0 with size 8222 #53

Open
forhonourlx opened this issue Aug 19, 2024 · 1 comment

Comments

@forhonourlx
Copy link

各位大佬,
运行报错求助,感激!

  • 数据获取命令:
# download 1d
python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn

train_maskable_ppo.py中时间参数修改:

    data_train = StockData(instrument=instruments,
                           start_time='2016-01-01',
                           end_time='2024-03-31')
    data_valid = StockData(instrument=instruments,
                           start_time='2024-04-01',
                           end_time='2024-06-30')
    data_test = StockData(instrument=instruments,
                          start_time='2024-07-01',
                          end_time='2024-08-15')

运行run:
python train_maskable_ppo.py --seed=25 --pool=10 --code=all --step=100000
报错error:

[26556:MainThread](2024-08-19 00:54:40,218) INFO - qlib.Initialization - [config.py:416] - default_conf: client.
[26556:MainThread](2024-08-19 00:54:40,768) INFO - qlib.Initialization - [__init__.py:74] - qlib successfully initialized based on client settings.
[26556:MainThread](2024-08-19 00:54:40,768) INFO - qlib.Initialization - [__init__.py:76] - data_path={'__DEFAULT_FREQ': WindowsPath('C:/Users/Administrator/.qlib/qlib_data/cn_data_rolling')}
[26556:MainThread](2024-08-19 00:56:16,074) ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[IndexError: index 8246 is out of bounds for axis 0 with size 8222].
  File "train_maskable_ppo.py", line 189, in <module>
    fire.Fire(fire_helper)
  File "C:\Users\Administrator\.conda\envs\qlib\lib\site-packages\fire\core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "C:\Users\Administrator\.conda\envs\qlib\lib\site-packages\fire\core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "C:\Users\Administrator\.conda\envs\qlib\lib\site-packages\fire\core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "train_maskable_ppo.py", line 181, in fire_helper
    main(_seed,
  File "train_maskable_ppo.py", line 111, in main
    data_test = StockData(instrument=instruments,
  File "C:\Users\Administrator\Desktop\DeepLearning\alphagen-0.1.0\alphagen_qlib\stock_data.py", line 37, in __init__
    self.data, self._dates, self._stock_ids = self._get_data()
  File "C:\Users\Administrator\Desktop\DeepLearning\alphagen-0.1.0\alphagen_qlib\stock_data.py", line 67, in _get_data
    df = self._load_exprs(features)
  File "C:\Users\Administrator\Desktop\DeepLearning\alphagen-0.1.0\alphagen_qlib\stock_data.py", line 61, in _load_exprs
    real_end_time = cal[end_index + self.max_future_days]
IndexError: index 8250 is out of bounds for axis 0 with size 8222
@forhonourlx
Copy link
Author

max_future_days 是不是要在测试集中扣除啊?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant