-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional inverse transform in historical forecast #2267
Add optional inverse transform in historical forecast #2267
Conversation
|
||
""" | ||
|
||
if not forecasts_list_transformed: |
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.
i don't get this point. If forecasts_list_transformed
is empty you are doing nothing right?
Can you check that before calling the method?
The method is private, so it should be used within this class.
Make it sense? :-)
return forecasts_list_transformed | ||
|
||
if isinstance(forecasts_list_transformed[0], TimeSeries): | ||
forecasts_list_inversely_transformed = scaler.inverse_transform( |
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.
forecasts_list_inversely_transformed = scaler.inverse_transform( | |
return scaler.inverse_transform( |
in this way you don't have to go down in the method to check what is returned in this case :-)
else: | ||
fill_value = TimeSeries.from_values(np.empty(1)) | ||
|
||
forecasts_list_inversely_transformed = list( |
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.
at this stage here the list is not inversely transformed. Perhaps another name for this variable.
"""Applies inverse transform on the list (of lists) of forecasts. | ||
Uses the scaler trained previously on the same set of series. |
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.
"""Applies inverse transform on the list (of lists) of forecasts. | |
Uses the scaler trained previously on the same set of series. | |
"""Applies inverse transform on the list (of lists) of forecasts, | |
using the scaler trained previously on the same set of series. |
scaler | ||
Optionally, the scaler trained on the same `series`, performs inverse transform on the generated forecasts. |
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.
scaler | |
Optionally, the scaler trained on the same `series`, performs inverse transform on the generated forecasts. | |
scaler | |
Optionally, the scaler trained on the same `series` is used to perform an inverse transform on the generated forecasts. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2267 +/- ##
==========================================
- Coverage 94.00% 93.94% -0.07%
==========================================
Files 136 136
Lines 13648 13673 +25
==========================================
+ Hits 12830 12845 +15
- Misses 818 828 +10 ☔ View full report in Codecov by Sentry. |
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.
Thanks for this Draft PR @alicjakrzeminska. I would suggest to move the logic to darts.dataprocessing.transformers.invertible_data_transformer.InvertibleDataTrasnformer
. In my opinion this can generally be applied to any InvertibleDataTransfomer
. What do you think?
* [A1, B1, C1] - list of series, | ||
* [[A1, A2, A3], [B1, B2], [C1, C2, C3]] - list of lists of series, |
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.
* [A1, B1, C1] - list of series, | |
* [[A1, A2, A3], [B1, B2], [C1, C2, C3]] - list of lists of series, | |
- [A1, B1, C1] - list of series, | |
- [[A1, A2, A3], [B1, B2], [C1, C2, C3]] - list of lists of series, |
Allows for different lengths of the lists. | ||
Allows for missing series the list. |
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.
Allows for different lengths of the lists. | |
Allows for missing series the list. | |
Supports lists of varying lengths and missing elements within the list/s. |
@dennisbader, I moved the function to |
@dennisbader, I integrated the functionality with |
for series_ in series_list: | ||
input_series.append(series_) | ||
data.append(series_) |
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.
for series_ in series_list: | |
input_series.append(series_) | |
data.append(series_) | |
input_series.extend(series_list) | |
data.extend(series_list |
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.
Really nice, thanks a lot for this great PR @alicjakrzeminska 🚀
Edit:
Checklist before merging this PR:
Fixes #2260.
Summary
InvertibleDataTransformer
now supports parallelized inverse transformation forseries
being a list of lists ofTimeSeries
(Sequence[Sequence[TimeSeries]]
). Thisseries
type represents for example the output fromhistorical_forecasts()
when using multiple series.