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

Add prophet regressor #1704

Merged
merged 38 commits into from
Jan 29, 2021
Merged

Add prophet regressor #1704

merged 38 commits into from
Jan 29, 2021

Conversation

jeremyliweishih
Copy link
Collaborator

@jeremyliweishih jeremyliweishih commented Jan 19, 2021

Fixes #1499.

  • File PR to add to AutoML and update installation docs.

@codecov
Copy link

codecov bot commented Jan 19, 2021

Codecov Report

Merging #1704 (de3629c) into main (d1a89af) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             main    #1704     +/-   ##
=========================================
+ Coverage   100.0%   100.0%   +0.1%     
=========================================
  Files         247      249      +2     
  Lines       19598    19740    +142     
=========================================
+ Hits        19589    19731    +142     
  Misses          9        9             
Impacted Files Coverage Δ
evalml/pipelines/components/__init__.py 100.0% <ø> (ø)
evalml/pipelines/components/estimators/__init__.py 100.0% <ø> (ø)
...alml/tests/model_family_tests/test_model_family.py 100.0% <ø> (ø)
evalml/utils/__init__.py 100.0% <ø> (ø)
evalml/model_family/model_family.py 100.0% <100.0%> (ø)
...lines/components/estimators/regressors/__init__.py 100.0% <100.0%> (ø)
...ponents/estimators/regressors/prophet_regressor.py 100.0% <100.0%> (ø)
evalml/tests/component_tests/test_components.py 100.0% <100.0%> (ø)
...ml/tests/component_tests/test_prophet_regressor.py 100.0% <100.0%> (ø)
evalml/tests/component_tests/test_utils.py 100.0% <100.0%> (ø)
... and 5 more

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 d1a89af...eb01777. Read the comment docs.

@jeremyliweishih jeremyliweishih marked this pull request as ready for review January 20, 2021 18:54
@@ -514,3 +514,38 @@ def save_plot(fig, filepath=None, format='png', interactive=False, return_filepa

if return_filepath:
return filepath


class suppress_stdout_stderr(object):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prophet doesn't have a flag for verbosity so we need this context manager to remove their training output:

facebook/prophet#223

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 we should add a link to the sktime original source

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@freddyaboulton the sktime source grabbed it from the issue so I think linking the issue is fine here

facebook/prophet#223 (comment)

@@ -9,3 +9,5 @@ matplotlib>=3.3.3
graphviz>=0.13
seaborn>=0.11.1
category_encoders>=2.0.0
pystan
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I left this open for now until we know what versions work with evalml. I can also just use latest versions for now.

estimators_to_check = [estimator for estimator in _all_estimators() if estimator not in [StackedEnsembleClassifier, StackedEnsembleRegressor, TimeSeriesBaselineEstimator]] + [test_estimator_needs_fitting_false]
for component_class in estimators_to_check:
if not component_class.needs_fitting:
continue

component = helper_functions.safe_init_component_with_njobs_1(component_class)
if component.supported_problem_types == [ProblemTypes.TIME_SERIES_REGRESSION]:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prophet does not follow sklearn's estimator API (and this is our first estimator that only does time series problem types) and tests in test_components.py break so I've added some work arounds here for now. Happy to discuss any of these changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I think it's fine to have this code outside a util function since it's only used twice and only in our tests.

component_obj=prophet_regressor,
random_state=random_state)

def build_prophet_df(self, X, y=None):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prophet requires input to be a single dataframe with a ds column for dates and yfor targets.

@@ -163,6 +163,15 @@ jobs:
conda config --add channels conda-forge
conda activate curr_py
conda install numba -q -y
- run:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need this for windows installation. In the PR to add prophet to automl we should also include installation instructions in our docs.

@jeremyliweishih
Copy link
Collaborator Author

PR should be good to go. Windows py3.6 tests hang on automl tests for some reason though. I'll take a look into it.

@freddyaboulton freddyaboulton added the new feature Features which don't yet exist. label Jan 20, 2021
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.

Looks good! Left a few comments, but agree with Freddy that it might be nice to add a 'column' arg to Prophet's init so we don't have to guess which column to use, esp if there are multiple datetime cols

@jeremyliweishih
Copy link
Collaborator Author

Still stuck on windows py3.6 tests taking 1hr+. Related to this issue(facebook/prophet#122) but it doesn't seem like their suggestions are working. Will keep working on it.

@jeremyliweishih jeremyliweishih merged commit 82f21f1 into main Jan 29, 2021
jeremyliweishih added a commit that referenced this pull request Jan 29, 2021
jeremyliweishih added a commit that referenced this pull request Jan 29, 2021
* Revert "Add prophet regressor (#1704)"

This reverts commit 82f21f1.

* rl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Features which don't yet exist.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time series regression: add Prophet estimator
3 participants