-
Notifications
You must be signed in to change notification settings - Fork 80
Conversation
etna/transforms/math/statistics.py
Outdated
name of processed column | ||
window: int | ||
size of window to aggregate | ||
out_column: str, optional |
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.
Many it would be better to put it in the last place
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.
fixed it in all the statistics Transforms 👌🏼
self.min_periods = min_periods | ||
self.fillna = fillna | ||
self.out_column = out_column | ||
super().__init__( |
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.
Better to follow the order of the parameters of the superclass
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.
Arguments orders in WindowStatisticsTransform
and all it's inheritors are different.
I think it's better to make MADTransform
's argument order the same with MeanTransform
, MaxTransform
, etc.
Moreover, I think that we should change the arguments order in WindowStatisticsTransform
but not at this PR (looks like big change).
df["target"] = [-1, 1, 3, 2, 4, 9, 8, 5, 6, 0] | ||
df["segment"] = "segment_1" | ||
|
||
df = df.pivot(index="timestamp", columns="segment") |
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.
TSDataset.to_dataset ?
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.
fixed all the fixtures here 👌🏼
@@ -177,6 +210,7 @@ def test_std_feature(simple_df_for_agg: pd.DataFrame, window: int, periods: int, | |||
MeanTransform(in_column="target", window=5), | |||
StdTransform(in_column="target", window=5), | |||
StdTransform(in_column="target", window=5), | |||
MADTransform(in_column="target", window=5), | |||
), | |||
) | |||
def test_fit_transform_with_nans(transform, ts_diff_endings): |
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.
This is a method was created to check that transforms simply don't fail working with NaNs. May you also create test that checks that this transform handles NaNs correctly.
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.
done
@@ -39,6 +54,8 @@ def simple_df_for_agg() -> pd.DataFrame: | |||
(MeanTransform, "test_mean"), | |||
(StdTransform, None), | |||
(StdTransform, "test_std"), | |||
(MADTransform, None), | |||
(MADTransform, "test_mad"), | |||
), | |||
) | |||
def test_interface_simple(simple_df_for_agg: pd.DataFrame, class_name: Any, out_column: str): |
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.
May be it is better to add docstring with description to the test like "Test that everything is fine"(oversimplified).
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.
@iKintosh says no comments for tests 😄
Codecov Report
@@ Coverage Diff @@
## master #441 +/- ##
==========================================
+ Coverage 87.64% 87.68% +0.03%
==========================================
Files 112 112
Lines 5276 5293 +17
==========================================
+ Hits 4624 4641 +17
Misses 652 652
Continue to review full report at Codecov.
|
@@ -177,6 +227,7 @@ def test_std_feature(simple_df_for_agg: pd.DataFrame, window: int, periods: int, | |||
MeanTransform(in_column="target", window=5), | |||
StdTransform(in_column="target", window=5), | |||
StdTransform(in_column="target", window=5), |
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.
May you also remove duplicates from the list of parameters here:pray:
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.
done
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Before submitting (must do checklist)
Type of Change
Proposed Changes
Related Issue
Closing issues
closes #426