You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QlibDataLoader resolves filter_pipe inside load_group_df(). With grouped field configs, load() calls load_group_df() once per fields group, so the same market string runs through D.instruments(..., filter_pipe=...) repeatedly.
This resolves string instruments once at the grouped-loader entry point and reuses that instrument config for each group. Direct load_group_df() calls keep the old behavior, and explicit non-string instrument lists still warn that filter_pipe is ignored.
Updated this with an Alpha158 handler-level regression test as well. The new test constructs Alpha158(..., filter_pipe=..., infer_processors=[], learn_processors=[]) and checks that D.instruments(..., filter_pipe=...) is still called once while feature and label groups are loaded separately.
I also ran the whole tests/data_mid_layer_tests/test_dataloader.py file after installing the missing mlflow dependency. The two filter-pipe tests pass, but the pre-existing test_nested_data_loader still needs local Qlib market data under ~/.qlib/qlib_data/cn_data and fails before reaching this change.
Thanks for the Alpha158 repro detail. The first version only moved D.instruments(...) out of the per-group loop, but D.features(...) still resolves stockpool configs through list_instruments(...) for each group, so feature and label could still apply the dynamic filter twice.
I pushed a follow-up commit that resolves a stockpool config with filter_pipe to the filtered instrument dict once per grouped loader/frequency, then reuses that dict for each group. The regression tests now assert that D.list_instruments(...) is called once and both feature/label groups receive the resolved instruments.
I also reran the full tests/data_mid_layer_tests/test_dataloader.py; the two relevant tests pass, while the pre-existing test_nested_data_loader still fails locally because this Windows machine does not have usable day-frequency Qlib market data under C:\Users\He\.qlib\qlib_data\cn_data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2236.
QlibDataLoaderresolvesfilter_pipeinsideload_group_df(). With grouped field configs,load()callsload_group_df()once per fields group, so the same market string runs throughD.instruments(..., filter_pipe=...)repeatedly.This resolves string instruments once at the grouped-loader entry point and reuses that instrument config for each group. Direct
load_group_df()calls keep the old behavior, and explicit non-string instrument lists still warn thatfilter_pipeis ignored.To verify
python -m pytest tests\data_mid_layer_tests\test_dataloader.py -q -k grouped_loaderpython -m py_compile qlib\data\dataset\loader.py tests\data_mid_layer_tests\test_dataloader.pygit diff --check