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

Raise ValueError when user attempts to use .y for a component that does not produce a y output #2662

Merged
merged 15 commits into from
Aug 24, 2021

Conversation

angela97lin
Copy link
Contributor

Closes #2569

@angela97lin angela97lin self-assigned this Aug 19, 2021
@codecov
Copy link

codecov bot commented Aug 19, 2021

Codecov Report

Merging #2662 (cd6077b) into main (2b3efcd) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2662     +/-   ##
=======================================
+ Coverage   99.9%   99.9%   +0.1%     
=======================================
  Files        298     298             
  Lines      27305   27320     +15     
=======================================
+ Hits       27261   27276     +15     
  Misses        44      44             
Impacted Files Coverage Δ
evalml/pipelines/component_graph.py 99.8% <100.0%> (+0.1%) ⬆️
...valml/tests/pipeline_tests/test_component_graph.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 2b3efcd...cd6077b. Read the comment docs.

self.component_instances = {}
self._is_instantiated = False
for component_name, component_info in self.component_dict.items():
component_class = handle_component_class(component_info[0])
self.component_instances[component_name] = component_class

self._validate_component_dict_edges()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this requires instantiation of components (to more easily handle detecting if the component is a subclass of a target transformer that would return a tuple), I had to create a separate helper method that was separate from self._validate_component_dict()

@@ -230,7 +230,7 @@ def test_init_bad_graphs():
def test_order_x_and_y():
graph = {
"Imputer": [Imputer, "X", "y"],
"OHE": [OneHotEncoder, "Imputer.x", "Imputer.y"],
"OHE": [OneHotEncoder, "Imputer.x", "y"],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new logic catches some cases where we created a graph and used a component's .y when it doesn't produce such!

Copy link
Contributor

@eccabay eccabay left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

Thank you @angela97lin !

evalml/pipelines/component_graph.py Outdated Show resolved Hide resolved
evalml/pipelines/component_graph.py Outdated Show resolved Hide resolved
Copy link
Contributor

@bchen1116 bchen1116 left a comment

Choose a reason for hiding this comment

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

LGTM! Agreed with Freddy's comments!

docs/source/release_notes.rst Outdated Show resolved Hide resolved
@angela97lin angela97lin merged commit 7eccf6e into main Aug 24, 2021
@angela97lin angela97lin deleted the 2569_no_y branch August 24, 2021 17:33
@chukarsten chukarsten mentioned this pull request Sep 1, 2021
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.

Define behavior when user attempts to use .y for a component that does not produce a y output
4 participants