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

Clean up ComponentGraph implementation #2612

Merged
merged 6 commits into from Aug 12, 2021
Merged

Clean up ComponentGraph implementation #2612

merged 6 commits into from Aug 12, 2021

Conversation

angela97lin
Copy link
Contributor

@angela97lin angela97lin commented Aug 10, 2021

Closes #2518

I'm still skeptical about fit_features and compute_final_component_features being useful but at this point, they're basically just the public facing API for our pipelines to use _fit_transform_features_helper. 🤷‍♀️

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

codecov bot commented Aug 10, 2021

Codecov Report

Merging #2612 (4974c67) into main (ce1830f) will decrease coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2612     +/-   ##
=======================================
- Coverage   99.9%   99.9%   -0.0%     
=======================================
  Files        297     297             
  Lines      27039   27033      -6     
=======================================
- Hits       26995   26989      -6     
  Misses        44      44             
Impacted Files Coverage Δ
.../tests/pipeline_tests/test_time_series_pipeline.py 100.0% <ø> (ø)
evalml/pipelines/component_graph.py 99.7% <100.0%> (-<0.1%) ⬇️
evalml/pipelines/pipeline_base.py 98.3% <100.0%> (-<0.1%) ⬇️

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 ce1830f...4974c67. Read the comment docs.

Copy link
Contributor

@chukarsten chukarsten left a comment

Choose a reason for hiding this comment

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

This looks good to me!

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.

Nice cleanup! Left some questions, but idt anything blocking.

@@ -621,7 +621,7 @@ def test_time_series_pipeline_not_fitted_error(
X, y = X_y_regression
clf = time_series_regression_pipeline_class(
parameters={
"Linear Regressor": {"n_jobs": 1},
"Random Forest Regressor": {"n_jobs": 1},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this to RFR?

Copy link
Contributor

Choose a reason for hiding this comment

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

@bchen1116 I can't be 100% sure but due to the occasional issues we're running into with LinearRegressor for time series problems, it might be better to default to a more consistent estimator, but I could be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is trying to use the fixture time_series_regression_pipeline_class which has a Random Forest Regressor, not Linear Regressor 😂 So just cleaning up the parameters so that it's actually used!

@pytest.fixture
def time_series_regression_pipeline_class():
    class TSRegressionPipeline(TimeSeriesRegressionPipeline):
        """Random Forest Regression Pipeline for time series regression problems."""

        component_graph = ["Delayed Feature Transformer", "Random Forest Regressor"]

        def __init__(self, parameters, random_seed=0):
            super().__init__(
                self.component_graph, parameters=parameters, random_seed=random_seed
            )

    return TSRegressionPipeline

parent, component_outputs.get(f"{parent}.x")
)
if isinstance(parent_output, pd.Series):
parent_output = pd.DataFrame(parent_output, columns=[parent])
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we no longer need to change the series to a dataframe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think no, this might have been outdated--we use ww's concat_columns and it takes both series and dfs :)

https://woodwork.alteryx.com/en/stable/generated/woodwork.utils.concat_columns.html#woodwork.utils.concat_columns

Copy link
Contributor

@ParthivNaresh ParthivNaresh left a comment

Choose a reason for hiding this comment

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

Great work!

evalml/pipelines/component_graph.py Show resolved Hide resolved
@@ -621,7 +621,7 @@ def test_time_series_pipeline_not_fitted_error(
X, y = X_y_regression
clf = time_series_regression_pipeline_class(
parameters={
"Linear Regressor": {"n_jobs": 1},
"Random Forest Regressor": {"n_jobs": 1},
Copy link
Contributor

Choose a reason for hiding this comment

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

Yessss

@angela97lin angela97lin merged commit 4eee441 into main Aug 12, 2021
@angela97lin angela97lin deleted the 2518_cg_refactor branch August 12, 2021 04:45
@chukarsten chukarsten mentioned this pull request Aug 12, 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.

Refactor underlying ComponentGraph implementation
4 participants