-
Notifications
You must be signed in to change notification settings - Fork 80
Add plot_imputation
#598
Merged
Add plot_imputation
#598
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_imputation
from etna.datasets import TSDataset
from etna.transforms import DensityOutliersTransform
from etna.transforms import TimeSeriesImputerTransform
def main():
df = pd.read_csv("examples/data/example_dataset.csv", parse_dates=["timestamp"])
ts = TSDataset(df=TSDataset.to_dataset(df), freq="D")
outliers_transform = DensityOutliersTransform(in_column="target", distance_coef=1.0)
ts.fit_transform(transforms=[outliers_transform])
# imputers
imputer_zero = TimeSeriesImputerTransform(in_column="target", strategy="zero")
imputer_running_mean = TimeSeriesImputerTransform(in_column="target", strategy="running_mean")
imputer_forward_fill = TimeSeriesImputerTransform(in_column="target", strategy="forward_fill")
# plots
plot_imputation(ts=ts, imputer=imputer_zero)
plt.savefig("imputer_zero")
plot_imputation(ts=ts, imputer=imputer_running_mean)
plt.savefig("imputer_running_mean")
plot_imputation(ts=ts, imputer=imputer_forward_fill)
plt.savefig("imputer_forward_fill")
if __name__ == "__main__":
main() |
Codecov Report
@@ Coverage Diff @@
## master #598 +/- ##
===========================================
- Coverage 85.35% 53.41% -31.95%
===========================================
Files 117 117
Lines 5789 5806 +17
===========================================
- Hits 4941 3101 -1840
- Misses 848 2705 +1857
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
martins0n
approved these changes
Mar 14, 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.
👍
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 #588.
Related Issue
#588.
Closing issues
Closes #588.