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

Remove ComponentGraph.from_list and update PipelineBase impl creating from lists #2549

Merged
merged 12 commits into from Jul 26, 2021

Conversation

angela97lin
Copy link
Contributor

@angela97lin angela97lin commented Jul 23, 2021

More breaking up #2490 into smaller and cleaner PRs :)

This PR removes from_list from ComponentGraph and updates PipelineBase'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_list updates 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 :)

@angela97lin angela97lin self-assigned this Jul 23, 2021
@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #2549 (1cc9eb2) into main (eb71f97) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           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             
Impacted Files Coverage Δ
...s/prediction_explanations_tests/test_explainers.py 100.0% <ø> (ø)
...understanding_tests/test_permutation_importance.py 100.0% <ø> (ø)
evalml/tests/pipeline_tests/test_pipeline_utils.py 100.0% <ø> (ø)
evalml/pipelines/component_graph.py 99.4% <100.0%> (+0.1%) ⬆️
evalml/pipelines/pipeline_base.py 99.7% <100.0%> (+0.1%) ⬆️
evalml/pipelines/utils.py 99.1% <100.0%> (-0.1%) ⬇️
evalml/tests/automl_tests/test_automl.py 99.8% <100.0%> (-<0.1%) ⬇️
...valml/tests/pipeline_tests/test_component_graph.py 100.0% <100.0%> (ø)
evalml/tests/pipeline_tests/test_pipelines.py 99.9% <100.0%> (+0.1%) ⬆️
.../tests/pipeline_tests/test_time_series_pipeline.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb71f97...1cc9eb2. Read the comment docs.

@@ -31,6 +31,10 @@ class ComponentGraph:
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):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No more lists allowed!

@@ -150,6 +151,34 @@ def linearized_component_graph(self):
"""A component graph in list form. Note that this is not guaranteed to be in proper component computation order"""
return ComponentGraph.linearized_component_graph(self.component_graph)

@staticmethod
def _make_component_dict_from_component_list(component_list):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this into pipeline_base... mostly because trying to import this from pipeline.utils.py, which imports PipelineBase, would otherwise create a circular dependency :/

@angela97lin angela97lin marked this pull request as ready for review July 26, 2021 16:48
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."
Copy link
Contributor

Choose a reason for hiding this comment

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

nit-pick: Should we list the component name in the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, done 😁

Copy link
Contributor

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

@angela97lin This looks good to me!

"SMOTENC Oversampler",
estimator,
]
component_graph={
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@angela97lin angela97lin merged commit 9c8acf7 into main Jul 26, 2021
@angela97lin angela97lin deleted the update_pipleine_from_list branch July 26, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants