-
Notifications
You must be signed in to change notification settings - Fork 80
Conversation
Codecov Report
@@ Coverage Diff @@
## master #565 +/- ##
==========================================
- Coverage 86.80% 86.36% -0.45%
==========================================
Files 119 119
Lines 5739 5773 +34
==========================================
+ Hits 4982 4986 +4
- Misses 757 787 +30
Continue to review full report at Codecov.
|
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.
Added comments on how it should be changed
etna/analysis/plotters.py
Outdated
labels = [transform.__repr__() for transform in trend_transform] | ||
labels_short = [i[: i.find("(")] for i in labels] | ||
if len(np.unique(labels_short)) == len(labels_short): | ||
labels = labels_short |
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.
Let's make it a private method, that constructs labels.
It should have small docsting on how it works:
If only unique transform classes are used then show their short names (without parameters)
Otherwise show their full repr as label
etna/analysis/plotters.py
Outdated
else: | ||
df_detrend = [trend_transform.fit_transform(df.copy())] | ||
labels = [trend_transform.__repr__()[: trend_transform.__repr__().find("(")]] |
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.
Remove this else
because it repeats the code above.
etna/analysis/plotters.py
Outdated
if isinstance(trend_transform, LinearTrendTransform) or isinstance(trend_transform, TheilSenTrendTransform): | ||
for seg in segments: | ||
|
||
linear_coeffs[seg] = ", k=" + str(trend_transform.segment_transforms[seg]._linear_model.coef_[0]) |
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 check should be done afterwards as a separate check.
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.
Just one fix needed
etna/analysis/plotters.py
Outdated
] | ||
|
||
|
||
def __get_labels_names(trend_transform, segments): |
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.
def __get_labels_names(trend_transform, segments): | |
def _get_labels_names(trend_transform, segments): |
etna/analysis/plotters.py
Outdated
trend_transform = [trend_transform] | ||
|
||
df_detrend = [transform.fit_transform(df.copy()) for transform in trend_transform] | ||
labels, linear_coeffs = __get_labels_names(trend_transform, segments) |
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.
labels, linear_coeffs = __get_labels_names(trend_transform, segments) | |
labels, linear_coeffs = _get_labels_names(trend_transform, segments) |
Same as above https://stackoverflow.com/a/1301369/7415703
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.
👍
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 #515