microsoft / microsoft/qlib

run workflow_config_lightgbm_multi_freq.yaml: KeyError: 'PRED'

Open
#1,740 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

Bug Description

when i run .\examples\benchmarks\LightGBM\workflow_config_lightgbm_multi_freq.yaml , i got error:

[9944:MainThread](2024-01-24 20:50:10,472) INFO - qlib.workflow - [recorder.py:374] - Fail to log the uncommitted code of $CWD(D:\Project\playground\quant\qlib\workflow_config_lightgbm_multi_freq) when run git diff --cached.
[9944:MainThread](2024-01-24 20:50:55,250) INFO - qlib.timer - [log.py:128] - Time cost: 41.668s | Loading data Done
[9944:MainThread](2024-01-24 20:50:55,253) INFO - qlib.timer - [log.py:128] - Time cost: 0.002s | DropnaLabel Done
D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\data\dataset\processor.py:324: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df[cols] = df[cols].groupby("datetime", group_keys=False).apply(self.zscore_func)
[9944:MainThread](2024-01-24 20:50:55,265) INFO - qlib.timer - [log.py:128] - Time cost: 0.012s | CSZScoreNorm Done
[9944:MainThread](2024-01-24 20:50:55,266) INFO - qlib.timer - [log.py:128] - Time cost: 0.016s | fit & process data Done
[9944:MainThread](2024-01-24 20:50:55,267) INFO - qlib.timer - [log.py:128] - Time cost: 41.685s | Init data Done
Training until validation scores don't improve for 50 rounds
[20] train's l2: 0.996655 valid's l2: 0.996655
[40] train's l2: 0.996655 valid's l2: 0.996655
Early stopping, best iteration is:
[1] train's l2: 0.996655 valid's l2: 0.996655
[9944:MainThread](2024-01-24 20:50:55,519) INFO - qlib.timer - [log.py:128] - Time cost: 0.186s | waiting async_log Done
[9944:MainThread](2024-01-24 20:50:55,522) ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[KeyError: 'PRED'].
File "D:\Anaconda\envs\py39\Scripts\qrun-script.py", line 33, in
sys.exit(load_entry_point('pyqlib==0.9.1.99', 'console_scripts', 'qrun')())
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\workflow\cli.py", line 72, in run
fire.Fire(workflow)
File "d:\anaconda\envs\py39\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "d:\anaconda\envs\py39\lib\site-packages\fire\core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "d:\anaconda\envs\py39\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\workflow\cli.py", line 66, in workflow
recorder = task_train(config.get("task"), experiment_name=experiment_name)
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\model\trainer.py", line 127, in task_train
exe_task(task_config)
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\model\trainer.py", line 56, in exe_task
task_config = fill_placeholder(task_config, placehorder_value)
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\utils_init
.py", line 929, in fill_placeholder
now_item[key] = get_item_from_obj(config, m.groupdict()["name_path"])
File "D:\Anaconda\envs\py39\lib\site-packages\pyqlib-0.9.1.99-py3.9-win-amd64.egg\qlib\utils_init
.py", line 874, in get_item_from_obj
cur_cfg = cur_cfg[k]
KeyError: 'PRED'

To Reproduce

Steps to reproduce the behavior:
use command:
qrun workflow_config_lightgbm_multi_freq.yaml

I used daily data and 1min freq data downloaded with qlib GetData().

Environment

  • Qlib version: 0.9.1.99
  • Python version: py39
  • OS : windows 10

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 with examples/benchmarks/LightGBM/workflow_config_lightgbm_multi_freq.yaml and reproduce it with qrun. Trace placeholder handling through qlib/model/trainer.py and qlib/utils/init.py, especially fill_placeholder and get_item_from_obj, to identify why PRED is missing. Done means the workflow runs without KeyError: 'PRED'.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.