microsoft / microsoft/qlib

assert tp_idx > 0 should be assert tp_idx >= 0?

Open
#1,610 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

在qlib\workflow\task\utils.py中的TimeAdjuster类的truncate()方法中,有个断言
assert tp_idx > 0
我觉得应该改为 assert tp_idx >= 0
若不改,那么在yaml中设置start_time为日历文件day.txt第一天时,运行滚动训练程序会报如下错误:
File "g:/qlibtutor/advance/online_srv/my_online_management_simulate_configfile.py", line 124, in main
self.rolling_online_manager.simulate(end_time=self.end_time)
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\online\manager.py", line 330, in simulate
self.first_train()
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\online\manager.py", line 172, in first_train
tasks = strategy.first_tasks()
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\online\strategy.py", line 163, in first_tasks
return task_generator(
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\task\gen.py", line 46, in task_generator
new_task_list.extend(gen.generate(task))
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\task\gen.py", line 300, in generate
trunc_segments(self.ta, segments, self.trunc_days, self.test_key)
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\task\gen.py", line 138, in trunc_segments
segments[k] = ta.truncate(segments[k], test_start, days)
File "E:\anaconda3\envs\qlib230510\lib\site-packages\qlib\workflow\task\utils.py", line 231, in truncate
assert tp_idx > 0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in qlib/workflow/task/utils.py at TimeAdjuster.truncate() and inspect how tp_idx is computed when start_time is the first day in day.txt. Reproduce the rolling-training failure with that configuration and verify that the boundary case no longer triggers the assertion.】【。} ошибки? I accidentally included Armenian? Need valid exact JSON and no weird. Reissue. retro. Ensure research 2 sentences.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, fintech-quant
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.