Skip to content

fix: allow disabling LightGBM early stopping#2228

Open
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/lightgbm-none-early-stopping
Open

fix: allow disabling LightGBM early stopping#2228
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/lightgbm-none-early-stopping

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • skip LightGBM early_stopping() callback creation when early_stopping_rounds resolves to None
  • apply the same guard to the high-frequency LightGBM wrapper
  • add regression tests that assert the wrappers omit the early-stopping callback when it is disabled

Fixes #2226

To verify

  • python -m py_compile qlib\contrib\model\gbdt.py qlib\contrib\model\highfreq_gdbt_model.py tests\model\test_lightgbm_early_stopping.py
  • python -m black --check --target-version py313 --fast tests\model\test_lightgbm_early_stopping.py
  • git diff --check

Local blocker

I tried python -m pytest tests\model\test_lightgbm_early_stopping.py -q, but this Windows checkout could not import qlib before collection because the Cython extension qlib.data._libs.rolling was not built. pip install -e . then failed while compiling that extension because MSVC could not find io.h from the local Python/Windows SDK setup. The test itself is included for CI where qlib's extension build is available.

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

Successfully merging this pull request may close these issues.

LightGBM 4.0+ Compatibility: TypeError when early_stopping_rounds=None

1 participant