Fix bugs and documentation for cross_corr_plot
#691
Merged
Merged
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
Mr-Geekman
added
bug
Something isn't working
documentation
Improvements or additions to documentation
labels
May 13, 2022
Example script: import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from etna.datasets import TSDataset
from etna.analysis import cross_corr_plot
def main():
df = pd.read_csv("examples/data/example_dataset.csv")
df = TSDataset.to_dataset(df)
ts = TSDataset(df, freq="D")
cross_corr_plot(ts=ts, n_segments=6, columns_num=2, maxlags=20)
plt.savefig("plot_columns_num_2.png")
cross_corr_plot(ts=ts, n_segments=6, columns_num=3, maxlags=20)
plt.savefig("plot_columns_num_3.png")
cross_corr_plot(ts=ts, segments=["segment_a", "segment_b", "segment_c"], maxlags=20)
plt.savefig("plot_set_segments.png")
# add some NaNs at the beginning of one segment
df.iloc[:5, 0] = np.NaN
ts = TSDataset(df, freq="D")
cross_corr_plot(ts=ts, maxlags=20)
plt.savefig("plot_nans_beginning.png")
# add some NaNs at the center of one segment
df.iloc[10, 1] = np.NaN
ts = TSDataset(df, freq="D")
cross_corr_plot(ts=ts, maxlags=20)
plt.savefig("plot_nans_middle.png")
if __name__ == "__main__":
main() |
🚀 Deployed on https://deploy-preview-691--etna-docs.netlify.app |
Codecov Report
@@ Coverage Diff @@
## master #691 +/- ##
==========================================
+ Coverage 84.09% 84.25% +0.15%
==========================================
Files 119 119
Lines 6412 6432 +20
==========================================
+ Hits 5392 5419 +27
+ Misses 1020 1013 -7
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
alex-hse-repository
suggested changes
May 17, 2022
@@ -33,11 +32,83 @@ | |||
plot_pacf = sm.graphics.tsa.plot_pacf | |||
|
|||
|
|||
def _cross_correlation( |
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.
Try to rewrite this method using np.convolve
to compute correlation and norms
alex-hse-repository
approved these changes
May 17, 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.
👍
4 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
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 #663.
Related Issue
#663.
Closing issues
Closes #663.