Repository navigation
Remove ComponentGraph.from_list and update PipelineBase impl creating from lists - #2549
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2549 +/- ##
=======================================
+ Coverage 99.9% 99.9% +0.1%
=======================================
Files 285 285
Lines 26167 26168 +1
=======================================
+ Hits 26131 26132 +1
Misses 36 36
Continue to review full report at Codecov.
|
| def __init__(self, component_dict=None, random_seed=0): | ||
| self.random_seed = random_seed | ||
| self.component_dict = component_dict or {} | ||
| if not isinstance(self.component_dict, dict): |
There was a problem hiding this comment.
No more lists allowed!
| return ComponentGraph.linearized_component_graph(self.component_graph) | ||
|
|
||
| @staticmethod | ||
| def _make_component_dict_from_component_list(component_list): |
There was a problem hiding this comment.
Moved this into pipeline_base... mostly because trying to import this from pipeline.utils.py, which imports PipelineBase, would otherwise create a circular dependency :/
| component = handle_component_class(component) | ||
| if not component._supported_by_list_API: | ||
| raise ValueError( | ||
| "This component cannot be defined in a list because edges may be ambiguous. Please use a dictionary to specify the appropriate component graph for this pipeline instead." |
There was a problem hiding this comment.
nit-pick: Should we list the component name in the message?
There was a problem hiding this comment.
Sure thing, done 😁
freddyaboulton
left a comment
There was a problem hiding this comment.
@angela97lin This looks good to me!
| "SMOTENC Oversampler", | ||
| estimator, | ||
| ] | ||
| component_graph={ |
More breaking up #2490 into smaller and cleaner PRs :)
This PR removes
from_listfrom ComponentGraph and updatesPipelineBase's implementation to handle creating a component dictionary to pass along to the ComponentGraph.This is slightly different from our behavior today because it puts the burden of converting from a list of components --> component dict on the pipeline. This means that ComponentGraphs do not need to understand how to handle lists.
Note that
_make_component_dict_from_component_listupdates the generated component graph to include X and y edges for each component, but it is not enforced yet! That will come in a later PR :)