Skip to content

[R-package] [python-package] deprecate Dataset arguments to cv() and train() - #6446

Merged
jameslamb merged 6 commits into
masterfrom
deprecate-args
May 11, 2024
Merged

jameslamb merged 6 commits into
masterfrom
deprecate-args

Conversation

@jameslamb

Copy link
Copy Markdown
Member

Contributes to #6435.

Adds deprecation warnings for all the cases mentioned in #6435, and some other changes that flow from that:

  • promotes categorical_feature and colnames to top-level arguments of lightgbm() in the R package
    • so it stops relying on lgb.train()'s support for setting those on the Dataset
  • modifies examples and tests to no longer use the deprecated pattern
  • updates relevant docs

Notes for Reviewers

I'd like to get these warnings out in the v4.4.0 release (#6439), and then leave them there for at least 2 more releases.

copying some others who may be interested: @mayer79 @david-cortes @simonpcouch

How I tested this

Ran the R tests and Python tests, and checked for these warnings.

# R
sh build-cran-package.sh --no-build-vignettes
R CMD INSTALL ./lightgbm_4.3.0.99.tar.gz
cd R-package/tests
Rscript testthat.R
cd ../../

# python
cmake -B build -S .
cmake --build build --target _lightgbm -j4
sh build-python.sh install --precompile
pytest tests/python_package_test

Interactively ran some code in both languages and confirmed that the expected warnings were raised.

@borchero borchero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks a lot!

@jameslamb

Copy link
Copy Markdown
Member Author

@jmoralez what do you think about this?

@jmoralez

Copy link
Copy Markdown
Collaborator

Hey. Sorry, I had given this a thumbs up but I guess my internet decided against it. I'm in favor of this, it'll reduce the complexity of the code and also avoid confusion on which place has the highest priority, etc.

@jameslamb

Copy link
Copy Markdown
Member Author

Great, thank you! I'm very glad someone asked about this on Stack Overflow... I've been staring at this code for 7 years and never noticed the duplication πŸ˜…

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants