Skip to content

Implement forecast decomposition for Prophet #1172

Merged
merged 11 commits into from
Mar 17, 2023
Merged

Conversation

brsnw250
Copy link
Collaborator

Before submitting (must do checklist)

  • Did you read the contribution guide?
  • Did you update the docs? We use Numpy format for all the methods and classes.
  • Did you write any new necessary tests?
  • Did you update the CHANGELOG?

Proposed Changes

Closing issues

closes #1161

@brsnw250 brsnw250 self-assigned this Mar 16, 2023
@github-actions
Copy link

github-actions bot commented Mar 16, 2023

@github-actions github-actions bot temporarily deployed to pull request March 16, 2023 13:38 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 16, 2023 14:40 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2023

Codecov Report

Merging #1172 (eae3411) into master (4920a92) will decrease coverage by 18.58%.
The diff coverage is 92.30%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##           master    #1172       +/-   ##
===========================================
- Coverage   86.94%   68.37%   -18.58%     
===========================================
  Files         177      177               
  Lines       10005    10032       +27     
===========================================
- Hits         8699     6859     -1840     
- Misses       1306     3173     +1867     
Impacted Files Coverage Δ
etna/models/prophet.py 97.26% <92.30%> (-2.74%) ⬇️

... and 68 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

CHANGELOG.md Outdated Show resolved Hide resolved
tests/test_models/test_prophet.py Outdated Show resolved Hide resolved
etna/models/prophet.py Outdated Show resolved Hide resolved
etna/models/prophet.py Outdated Show resolved Hide resolved
etna/models/prophet.py Outdated Show resolved Hide resolved
etna/models/prophet.py Outdated Show resolved Hide resolved
etna/models/prophet.py Outdated Show resolved Hide resolved

holiday_names = set(model.train_holiday_names) if model.train_holiday_names is not None else set()

components_data = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we do it all at once(not in the cycle)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can try to do here vecorization, but main reason of this solution is to persist consistency with similar method from prophet. I don't think we will gain much speed up vectorizing this cycle. Also, we can't throw out the cycle fully as we need to filter individual holidays and aggregated components from columns in component cols.

Copy link
Collaborator

@alex-hse-repository alex-hse-repository Mar 17, 2023

Choose a reason for hiding this comment

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

First of all, we can filter out the unnecessary components before the cycle, the second thing is that Prophet team does not plan to change the model, so we don't need to maintain code consistency if it can be vectorized

tests/test_models/test_prophet.py Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request March 17, 2023 08:14 Inactive
@@ -135,10 +134,7 @@ def predict(self, df: pd.DataFrame, prediction_interval: bool, quantiles: Sequen
DataFrame with predictions
"""
df = df.reset_index()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why didn't you put this line inside the _prepare_prophet_df ? You can add this line in fit too


holiday_names = set(model.train_holiday_names) if model.train_holiday_names is not None else set()

components_data = {}
Copy link
Collaborator

@alex-hse-repository alex-hse-repository Mar 17, 2023

Choose a reason for hiding this comment

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

First of all, we can filter out the unnecessary components before the cycle, the second thing is that Prophet team does not plan to change the model, so we don't need to maintain code consistency if it can be vectorized

@github-actions github-actions bot temporarily deployed to pull request March 17, 2023 11:44 Inactive
@alex-hse-repository alex-hse-repository enabled auto-merge (squash) March 17, 2023 12:10
@github-actions github-actions bot temporarily deployed to pull request March 17, 2023 12:14 Inactive
@alex-hse-repository alex-hse-repository merged commit e91f5f2 into master Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement forecast decomposition for Prophet
3 participants