Repository navigation
Limit interaction_cst to list/tuple of lists/tuples/sets in HistGradientBoosting* - #24915
Merged
jeremiedbb merged 3 commits intoNov 22, 2022
Merged
jeremiedbb merged 3 commits into
jeremiedbb merged 3 commits into
Conversation
Member
Author
|
This is ready for review |
Instead of allowing arbitrary "iterable of iterables" the itneraction_cst parameter is constrained to be a sequence (list, tuple) of list/tuple/set of integers.
betatim
force-pushed
the
fix-interaction_cst-parameter-validation
branch
from
November 17, 2022 13:48
3509e84 to
9006201
Compare
Member
Author
|
If you have time, a brief review would be welcome @lorentzenchr |
lorentzenchr
approved these changes
Nov 22, 2022
lorentzenchr
left a comment
Member
There was a problem hiding this comment.
LGTM Better to start conservative with this new feature.
jeremiedbb
approved these changes
Nov 22, 2022
Member
|
Thanks @betatim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of allowing arbitrary "iterable of iterables" the interaction_cst parameter is constrained to be a sequence (list, tuple) of list/tuple/set of integers.
Reference Issues/PRs
Closes #24899
Any other comments?
It feels more "pythonic" (but I hate that as an argument to justify coding choices) to try and iterate over the input and convert it into a list of sets. Instead of trying to nail down the exact allowed types of inputs. What we care about here is that the user's input can be turned into a list of sets of integers.
The docstring says "sequence of tuples/list of ints", this was the best formulation I could find. Even though this "sequence" isn't meant to be the Python type
collections.abc.Sequence. I think the chance of a user misunderstanding it (and sending their strict typing lawyers after us) is low.I don't really like that we limit to
listandtuplein the parameter validation, but I can't think of a better way. My preferred option would probably be to writecollections.abc.Sequencein_parameter_constraintscombined with the later checks in the class.