Skip to content

docs: Update LightGBM API examples to use modern callbacks#2100

Open
ayushozha wants to merge 1 commit intomicrosoft:mainfrom
ayushozha:fix/issue-904-lightgbm-api-docs
Open

docs: Update LightGBM API examples to use modern callbacks#2100
ayushozha wants to merge 1 commit intomicrosoft:mainfrom
ayushozha:fix/issue-904-lightgbm-api-docs

Conversation

@ayushozha
Copy link
Copy Markdown

Summary

  • Update Custom Model Integration documentation to use LightGBM's modern callback-based API
  • The deprecated parameters (early_stopping_rounds, verbose_eval, evals_result) were removed in LightGBM 4.0 and now cause errors

Problem

Users following the documentation would get:

train() got an unexpected keyword argument 'early_stopping_rounds'

Solution

Replace deprecated parameters with callbacks:

  • early_stopping_roundslgb.early_stopping()
  • verbose_evallgb.log_evaluation()
  • evals_resultlgb.record_evaluation()

Test plan

  • Verified LightGBM 4.6.0 rejects old API
  • Verified new callback API works correctly
  • Changes match existing implementation in qlib/contrib/model/gbdt.py

Fixes #904

Update the Custom Model Integration documentation to use the modern
callback-based API for LightGBM instead of the deprecated parameters.

The deprecated parameters (early_stopping_rounds, verbose_eval,
evals_result) were removed in LightGBM 4.0 and now cause errors:
"train() got an unexpected keyword argument 'early_stopping_rounds'"

Changes:
- Replace deprecated early_stopping_rounds with lgb.early_stopping()
- Replace deprecated verbose_eval with lgb.log_evaluation()
- Replace deprecated evals_result with lgb.record_evaluation()
- Add comments explaining the callback requirement for LightGBM >= 4.0

Fixes microsoft#904
@ayushozha
Copy link
Copy Markdown
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