Skip to content

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

Merged
angela97lin merged 12 commits into
mainfrom
update_pipleine_from_list
Jul 26, 2021
Merged

angela97lin merged 12 commits into
mainfrom
update_pipleine_from_list

Conversation

@angela97lin

@angela97lin angela97lin commented Jul 23, 2021 •

Copy link
Copy Markdown
Contributor

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

codecov Bot commented Jul 23, 2021 •

Copy link
Copy Markdown

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.

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
Copy Markdown
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!

return ComponentGraph.linearized_component_graph(self.component_graph)

@staticmethod
def _make_component_dict_from_component_list(component_list):

Copy link
Copy Markdown
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:38
@angela97lin
angela97lin marked this pull request as draft July 26, 2021 16:41
@angela97lin
angela97lin marked this pull request as ready for review July 26, 2021 16:48
Comment thread evalml/pipelines/pipeline_base.py Outdated
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
Copy Markdown
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
Copy Markdown
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 😁

@freddyaboulton freddyaboulton left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

2 participants