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
DDG-DA (Data Distribution Guided Domain Adaptation) workflow is completely broken due to a chain of sequential bugs. Each bug masks the next one, making them impossible to discover without fixing the previous bug first.
To Reproduce
Important Prerequisites:
This bug chain can only be reproduced after PR #2230 is merged. Without PR #2230, you will encounter the zscore unpickling error first, which masks all subsequent bugs.
# Build callbacks list dynamicallycallbacks= []
# Only add early_stopping callback if rounds is not None (LightGBM 4.0+ compatibility)early_stop_rounds=self.early_stopping_roundsifearly_stopping_roundsisNoneelseearly_stopping_roundsifearly_stop_roundsisnotNone:
callbacks.append(lgb.early_stopping(early_stop_rounds))
callbacks.append(lgb.log_evaluation(period=verbose_eval))
callbacks.append(lgb.record_evaluation(evals_result))
self.model=lgb.train(..., callbacks=callbacks, ...)
data_key=task["dataset"]["kwargs"]["segments"]["train"]
# Convert list to tuple to make it hashableifisinstance(data_key, list):
data_key=tuple(data_key)
key_l.append(data_key)
def_calc_perf(self, pred, label):
df=pd.DataFrame({"pred": pred, "label": label})
df=df.groupby("datetime").corr(method="spearman") # Remove group_keys=False# Use xs to select 'label' from the second level of MultiIndexcorr=df.xs("label", level=1)["pred"]
returncorr
Testing
After applying all three fixes:
cd examples/benchmarks_dynamic/DDG-DA
rm -rf mlruns
python workflow.py run
🐛 Bug Description
DDG-DA (Data Distribution Guided Domain Adaptation) workflow is completely broken due to a chain of sequential bugs. Each bug masks the next one, making them impossible to discover without fixing the previous bug first.
To Reproduce
Important Prerequisites:
This bug chain can only be reproduced after PR #2230 is merged. Without PR #2230, you will encounter the zscore unpickling error first, which masks all subsequent bugs.
Steps to reproduce:
Apply PR Fix/pickle whitelist zscore #2230 (zscore and InternalData pickle whitelist):
Run DDG-DA workflow:
cd examples/benchmarks_dynamic/DDG-DA rm -rf mlruns python workflow.py runObserve the bug chain (each bug is revealed after fixing the previous one)
The Bug Chain
Bug 1: LightGBM 4.0+ Compatibility Issue⚠️ Blocks all subsequent bugs
Error:
Location:
qlib/contrib/model/gbdt.py:71-73Root Cause:
Noneforearly_stopping_roundsparameterearly_stopping_rounds=Noneto disable early stoppinglgb.early_stopping(), causing TypeErrorImpact: DDG-DA workflow fails immediately after completing meta-model training tasks
Bug 2: Unhashable List Type Error⚠️ Revealed after fixing Bug 1
Error:
Location:
qlib/contrib/meta/data_selection/dataset.py:97-102Root Cause:
Impact: InternalData.setup() fails when trying to create DataFrame with list as column keys
Bug 3: Incorrect Pandas MultiIndex Selection⚠️ Revealed after fixing Bug 2
Error:
Location:
qlib/contrib/meta/data_selection/dataset.py:110-114Root Cause:
Problems:
df.loc(axis=0)is incorrect syntax (should bedf.loc[...])group_keys=Falsecauses loss of datetime indexdroplevelwhen only 1 level existsImpact: _calc_perf() fails during correlation calculation
Expected Behavior
DDG-DA workflow should run successfully from start to finish:
Environment
0.9.8.dev33(main branch)3.8.10Linux(Ubuntu 22.04)4.6.0(affects 4.0+)Why These Bugs Form a Chain
This is why they were not discovered earlier - each bug completely blocks the workflow, masking all subsequent bugs.
Proposed Solution
All three bugs must be fixed together for DDG-DA to work. The fixes are:
Fix 1: LightGBM 4.0+ Compatibility
Files:
qlib/contrib/model/gbdt.py,qlib/contrib/model/highfreq_gdbt_model.pyFix 2: Convert List to Tuple
File:
qlib/contrib/meta/data_selection/dataset.py:97-100Fix 3: Fix Pandas MultiIndex Selection
File:
qlib/contrib/meta/data_selection/dataset.py:110-114Testing
After applying all three fixes:
cd examples/benchmarks_dynamic/DDG-DA rm -rf mlruns python workflow.py runExpected output:
Additional Notes
Why submit as one issue?
Dependencies:
Impact:
Related: