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 _needs_fitting attribute from Components #398

Merged
merged 31 commits into from Feb 26, 2020

Conversation

jeremyliweishih
Copy link
Contributor

@jeremyliweishih jeremyliweishih commented Feb 19, 2020

Fixes #366

  • try fitting on every component
  • remove unused ComponentBase.fit_transform in PipelineBase._fit
  • have Transformer.transform accept optional y argument

@codecov
Copy link

codecov bot commented Feb 19, 2020

Codecov Report

Merging #398 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #398      +/-   ##
==========================================
+ Coverage   97.45%   97.47%   +0.01%     
==========================================
  Files         105      105              
  Lines        3267     3282      +15     
==========================================
+ Hits         3184     3199      +15     
  Misses         83       83
Impacted Files Coverage Δ
...ml/pipelines/classification/logistic_regression.py 100% <ø> (ø) ⬆️
evalml/automl/auto_classification_search.py 100% <ø> (ø) ⬆️
evalml/pipelines/classification/catboost.py 100% <ø> (ø) ⬆️
evalml/automl/auto_regression_search.py 100% <ø> (ø) ⬆️
evalml/pipelines/regression/catboost.py 100% <ø> (ø) ⬆️
evalml/tests/pipeline_tests/test_pipelines.py 100% <100%> (ø) ⬆️
evalml/automl/auto_base.py 92.74% <100%> (+0.02%) ⬆️
evalml/pipelines/pipeline_base.py 99.29% <100%> (+0.01%) ⬆️
...ts/automl_tests/test_auto_classification_search.py 100% <100%> (ø) ⬆️
.../tests/automl_tests/test_auto_regression_search.py 100% <100%> (ø) ⬆️

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 5ed2f49...e4e161d. Read the comment docs.

@jeremyliweishih jeremyliweishih changed the title Remove _needs_fitting attribute from Components [WIP] Remove _needs_fitting attribute from Components Feb 19, 2020
@jeremyliweishih jeremyliweishih changed the title [WIP] Remove _needs_fitting attribute from Components Remove _needs_fitting attribute from Components Feb 20, 2020
@jeremyliweishih jeremyliweishih requested review from angela97lin, dsherry and christopherbunn and removed request for angela97lin February 20, 2020 17:50
@jeremyliweishih jeremyliweishih self-assigned this Feb 21, 2020
@dsherry
Copy link
Contributor

dsherry commented Feb 21, 2020

Good stuff. Left some comments, in particular having to do with Transformer.transform/Transformer.fit_transform.

Copy link
Contributor

@angela97lin angela97lin left a comment

Choose a reason for hiding this comment

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

LGTM! :D I added a few tiny comments that are more suggestions / food for thoughts rather than need for change.

transformer.fit_transform(X)
with pytest.raises(MethodPropertyNotFoundError, match="Transformer requires a transform method or a component_obj that implements transform"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, this test makes me wonder: would it be confusing for a user who tries to call transformer.fit_transform(X) to instead get an error that says ""Transformer requires a transform method or a component_obj that implements transform" instead? Perhaps stack trace is enough to make this clear? :O

evalml/tests/component_tests/test_components.py Outdated Show resolved Hide resolved
self.fit(X, y)
X_t = self.transform(X, y)
except MethodPropertyNotFoundError as e:
raise e
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to this. Let's make sure we have test coverage for:

  • Component has valid fit_transform method
  • Component has fit_transform method but it throws an exception, like a RuntimeError
  • Component has no fit_transform method, but fit and transform work
  • Component has no fit_transform method, and fit or transform throw


Arguments:
X (pd.DataFrame): Data to transform
y (pd.Series, optional): Input Labels
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the optional should go somewhere after the colon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dsherry optional inside the parentheses is currently our convention in the codebase. It would be easier to keep this as is and keep track of the convention in a separate issue if we want to change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah cool, didn't know.

@jeremyliweishih jeremyliweishih merged commit 95fc601 into master Feb 26, 2020
@angela97lin angela97lin mentioned this pull request Mar 9, 2020
@dsherry dsherry deleted the 366_needs_fitting branch May 26, 2020 21:07
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.

Delete _needs_fitting parameter
3 participants