Skip to content

fix: upgrade deprecated LightGBM API in docs and version constraints#2145

Open
Bortlesboat wants to merge 1 commit intomicrosoft:mainfrom
Bortlesboat:fix-lightgbm-deprecation
Open

fix: upgrade deprecated LightGBM API in docs and version constraints#2145
Bortlesboat wants to merge 1 commit intomicrosoft:mainfrom
Bortlesboat:fix-lightgbm-deprecation

Conversation

@Bortlesboat
Copy link

Summary

  • Update documentation (docs/start/integration.rst) to use LightGBM's modern callback-based API instead of deprecated parameters
  • Set minimum lightgbm>=3.3.0 in pyproject.toml (callback API was introduced in 3.3.0)
  • Update example requirements.txt files from lightgbm==3.1.0 to lightgbm>=3.3.0

Problem

The core model code was already fixed in PR #974 to use callbacks (lgb.early_stopping(), lgb.log_evaluation(), lgb.record_evaluation()), but:

  1. The documentation still showed the deprecated API (early_stopping_rounds, verbose_eval, evals_result passed directly to lgb.train()), which was removed in LightGBM 4.0
  2. The minimum version in pyproject.toml had no lower bound, allowing installation of LightGBM versions that don't support the callback API
  3. Example requirements.txt files pinned lightgbm==3.1.0, which predates the callback API (introduced in 3.3.0)

Changes

File Change
docs/start/integration.rst Replace deprecated lgb.train() parameters with callback equivalents
pyproject.toml "lightgbm""lightgbm>=3.3.0"
examples/benchmarks/DoubleEnsemble/requirements.txt lightgbm==3.1.0lightgbm>=3.3.0
examples/hyperparameter/LightGBM/requirements.txt lightgbm==3.1.0lightgbm>=3.3.0

Test plan

  • Verified core model files (gbdt.py, highfreq_gdbt_model.py, double_ensemble.py) already use callback API correctly
  • Documentation examples now match the actual implementation in qlib/contrib/model/gbdt.py
  • Version constraint ensures compatibility with the callback-based code

Closes #904

🤖 Generated with Claude Code

…aints

The core model code (gbdt.py, highfreq_gdbt_model.py, double_ensemble.py)
was already updated to use LightGBM's callback-based API in PR microsoft#974, but
the documentation and version constraints were not updated to match:

- Update docs/start/integration.rst to use lgb.early_stopping(),
  lgb.log_evaluation(), and lgb.record_evaluation() callbacks instead of
  the deprecated early_stopping_rounds, verbose_eval, and evals_result
  parameters (removed in LightGBM 4.0)
- Set minimum lightgbm>=3.3.0 in pyproject.toml (callback API introduced
  in 3.3.0)
- Update example requirements.txt files from lightgbm==3.1.0 to
  lightgbm>=3.3.0 to match the callback API usage in the codebase

Closes microsoft#904

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Bortlesboat
Copy link
Author

@microsoft-github-policy-service agree

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.

Upgrading lightGBM API usage

1 participant