Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reproducible parameter alias resolution for wrappers (fixes #5304) #5338

Merged
merged 8 commits into from
Jul 30, 2022

Conversation

jmoralez
Copy link
Collaborator

Extracts the current logic on the C++ side to sort aliases to a function Config::SortAlias so that Config::DumpAliases can use the same criteria to sort them and allow the wrappers to be in sync.

Fixes #5304

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Very very nice work! Please see a few initial suggestions. I'll take a look again soon, but overall I'm supportive of the approach you took and I'm confident that these code paths are heavily tested.

I'd also like to wait to merge this until @StrikerRUS has a chance to review as well.

tests/python_package_test/test_basic.py Outdated Show resolved Hide resolved
python-package/lightgbm/basic.py Show resolved Hide resolved
R-package/R/utils.R Outdated Show resolved Hide resolved
Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks a lot for doing this!

Just one question for my better understanding.

python-package/lightgbm/basic.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just left one minor suggestion. Feel free to merge this once that's addressed.

@@ -55,7 +55,7 @@ test_that(".PARAMETER_ALIASES() returns a named list of character vectors, where
expect_true(length(names(param_aliases)) == length(param_aliases))
expect_true(all(sapply(param_aliases, is.character)))
expect_true(length(unique(names(param_aliases))) == length(param_aliases))
expect_equal(sort(param_aliases[["task"]]), c("task", "task_type"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, looking at this again....why does this assertion need to be removed?

I understand why this PR adds the other one below that doesn't use sort(), but could we still keep the rest of this test intact? That would give me a bit more confidence that this change is working as expected, and having tests here referencing two different parameters increases the likelihood of catching bugs of the form ".PARAMETER_ALIASES() returns unexpected output for some but not all parameters".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Restored in e45fc48

@jmoralez
Copy link
Collaborator Author

@shiyu1994 I'd appreciate your review if you have time.

Copy link
Collaborator

@guolinke guolinke left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM!

@StrikerRUS StrikerRUS merged commit 83627ff into master Jul 30, 2022
@StrikerRUS StrikerRUS deleted the sort-aliases branch July 30, 2022 20:25
@jameslamb jameslamb mentioned this pull request Oct 7, 2022
40 tasks
@github-actions
Copy link

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 Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ensure consistent, reproducible choice when multiple parameter aliases are given
4 participants