-
Notifications
You must be signed in to change notification settings - Fork 80
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example script: import matplotlib.pyplot as plt
import pandas as pd
from etna.analysis import plot_metric_per_segment
from etna.datasets import TSDataset
from etna.metrics import MAE
from etna.metrics import SMAPE
from etna.models import ProphetModel
from etna.pipeline import Pipeline
def main():
df = pd.read_csv("examples/data/example_dataset.csv", parse_dates=["timestamp"])
df_wide = TSDataset.to_dataset(df)
ts = TSDataset(df=df_wide, freq="D")
pipeline = Pipeline(model=ProphetModel(), horizon=10)
metrics_df, _, _ = pipeline.backtest(ts=ts, n_folds=3, metrics=[MAE(), SMAPE()])
plot_metric_per_segment(metrics_df=metrics_df, metric_name="MAE", per_fold_aggregation_mode="mean")
plt.savefig("metric_per_segment_plot")
pipeline = Pipeline(model=ProphetModel(), horizon=10)
metrics_df, _, _ = pipeline.backtest(ts=ts, n_folds=3, metrics=[MAE(), SMAPE()])
plot_metric_per_segment(
metrics_df=metrics_df, metric_name="MAE", per_fold_aggregation_mode="mean", ascending=True, top_k=2
)
plt.savefig("metric_per_segment_plot_limited")
if __name__ == "__main__":
main() |
🚀 Deployed on https://deploy-preview-658--etna-docs.netlify.app |
Codecov Report
@@ Coverage Diff @@
## master #658 +/- ##
==========================================
- Coverage 84.45% 84.14% -0.32%
==========================================
Files 119 119
Lines 6322 6356 +34
==========================================
+ Hits 5339 5348 +9
- Misses 983 1008 +25
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
iKintosh
suggested changes
Apr 28, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seem I have found a bug =)
etna/analysis/plotters.py
Outdated
if self.value == "mean": | ||
return np.nanmean | ||
elif self.value == "median": | ||
return self.nanmedian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it is self.nanmedian
and not np.nanmedian
?
# Conflicts: # CHANGELOG.md
iKintosh
approved these changes
Apr 29, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Before submitting (must do checklist)
Type of Change
Proposed Changes
Look #545.
Related Issue
#545.
Closing issues
Closes #545.