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.
ENH more efficient _num_combinations calculation in PolynomialFeatures #19734
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
ENH more efficient _num_combinations calculation in PolynomialFeatures #19734
Changes from all commits
c96e0fa
cff4755
835aa69
cd6290a
44a5b39
094534e
a90f888
558c4a8
1d857f2
1d4054d
c1b78ad
ed7abd6
f8bbfb1
4219612
d8613c8
48b01c0
04cfdfc
510f6e4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not be sufficient to just assert that the width of the transformed matrix is equal to n_features_out_ rather than testing the private API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to test
n_output_features_
instead of_num_combinations
. Good call.I'm still comparing it to
sum([1 for _ in self._combinations])
though. Comparing it to the width of the transformed matrix would couple this test to the implementation oftransform
we happen to get and not all of the implementations are so straightforward. I'd prefer to avoid that if possible.If your objection is to using the private method I would propose just copy / pasting that definition into this test.
Of course, we can just do it your way too 🤷 let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any real issue about this, although I've not checked if the size of
_combinations
is tested elsewhere in the file.