Skip to content

Visualization for forecast decomposition #1129

Merged
merged 6 commits into from Feb 28, 2023
Merged

Visualization for forecast decomposition #1129

merged 6 commits into from Feb 28, 2023

Conversation

brsnw250
Copy link
Collaborator

@brsnw250 brsnw250 commented Feb 23, 2023

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

Per-component mode

image

Together mode

image

Closing issues

closes #1121

@brsnw250 brsnw250 self-assigned this Feb 23, 2023
@github-actions
Copy link

github-actions bot commented Feb 23, 2023

@github-actions github-actions bot temporarily deployed to pull request February 23, 2023 11:01 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2023

Codecov Report

Merging #1129 (9d34e2a) into master (67dfebc) will decrease coverage by 18.81%.
The diff coverage is 19.56%.

📣 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    #1129       +/-   ##
===========================================
- Coverage   86.97%   68.17%   -18.81%     
===========================================
  Files         170      170               
  Lines        9361     9402       +41     
===========================================
- Hits         8142     6410     -1732     
- Misses       1219     2992     +1773     
Impacted Files Coverage Δ
etna/analysis/plotters.py 11.11% <16.27%> (-13.17%) ⬇️
etna/datasets/utils.py 46.06% <50.00%> (-49.34%) ⬇️
etna/analysis/__init__.py 100.00% <100.00%> (ø)
etna/commands/__main__.py 0.00% <0.00%> (-87.50%) ⬇️
etna/datasets/hierarchical_structure.py 22.01% <0.00%> (-75.23%) ⬇️
etna/libs/pmdarima_utils/arima.py 28.84% <0.00%> (-71.16%) ⬇️
etna/pipeline/assembling_pipelines.py 26.31% <0.00%> (-71.06%) ⬇️
etna/pipeline/mixins.py 31.42% <0.00%> (-67.62%) ⬇️
etna/analysis/outliers/hist_outliers.py 10.82% <0.00%> (-66.25%) ⬇️
etna/reconciliation/bottom_up.py 35.29% <0.00%> (-64.71%) ⬇️
... and 61 more

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

def plot_forecast_decomposition(
forecast_ts: "TSDataset",
test_ts: Optional["TSDataset"] = None,
mode: str = ComponentsMode.per_component,
Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't really a correct typing because ComponentsMode.per_component isn't a string. May be ComponentsMode.per_component.value would work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed

@Mr-Geekman
Copy link
Contributor

Mr-Geekman commented Feb 27, 2023

I think it is better to attach the exact script, that generated these plots. Like here.

@Mr-Geekman
Copy link
Contributor

Can we try to make these plots like for stl_plot? I don't really like that in per-segment mode all the plots related to one segment isn't connected.

@@ -187,6 +187,11 @@ def match_target_quantiles(features: Set[str]) -> Set[str]:
return {i for i in list(features) if pattern.match(i) is not None}


def match_target_components(features: Set[str]) -> Set[str]:
"""Find target components in dataframe columns."""
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have any columns and dataframes inside this function. May be we should change description a little bit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@Mr-Geekman Mr-Geekman left a comment

Choose a reason for hiding this comment

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

Add changelog.

Look at comments above.

@brsnw250
Copy link
Collaborator Author

Regarding adding a sample script. It can be added, but right now it will create the necessary dataset manually (artificially adding components columns). It isn't very informative because this is not the intended usage of this function.

@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 11:24 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 11:33 Inactive
@brsnw250
Copy link
Collaborator Author

brsnw250 commented Feb 27, 2023

Updated layout of charts for per-component mode. Examples in PR description are updated as well.

CHANGELOG.md Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:30 Inactive
@brsnw250 brsnw250 merged commit 3e0cae7 into master Feb 28, 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.

Create visualization for forecast decomposition
3 participants