-
Notifications
You must be signed in to change notification settings - Fork 86
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
Component iteration in pipelines #1583
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1583 +/- ##
=========================================
+ Coverage 100.0% 100.0% +0.1%
=========================================
Files 242 242
Lines 19075 19143 +68
=========================================
+ Hits 19067 19135 +68
Misses 8 8
Continue to review full report at Codecov.
|
9289ca2
to
a742008
Compare
a742008
to
2d4f2ce
Compare
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.
really cool! looks good to me.
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.
Looks great! Tests are solid, just curious what happens if index is not valid :P
def test_linear_getitem(logistic_regression_binary_pipeline_class): | ||
pipeline = logistic_regression_binary_pipeline_class({'One Hot Encoder': {'top_n': 4}}) | ||
|
||
assert pipeline[0] == Imputer() |
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.
Amazing! Just to confirm, giving an invalid index throws... an IndexError? Or ValueError? Just curious since get_component throws a ValueError :p
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.
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.
This is super cool! LGTM!
Closes #1571
Obviously I'm not going to get this in before I leave today, but I had the time so I did what I couldContext since this is an old branch:
This PR addresses a breaking change made in #1543. Prior to #1543, the documented way to iterate through component instances was
[c for c in pipeline.component_graph]
. However, #1543 made it so that thecomponent_graph
attribute only lists the classes, not the instances. Rather than having users iterate through the private_component_graph
attribute, we add a "public" accessor by making the pipelines iterable.This PR accomplishes that by:
__iter__
and__next__
method to pipelines (as opposed to relying on__getitem__
)