Repository navigation
ENH: Add min_timeshift support to make_forecasting_frame - #1121
Conversation
nils-braun
left a comment
There was a problem hiding this comment.
Well done @Lulloooo and welcome! PR already looks quite good, just a few finishing touches needed
| # Check fewer rows (core behavior) | ||
| assert len(df_filtered) < len(df_default) | ||
| # Check target is aligned | ||
| assert len(y_filtered) == len(df_filtered.groupby("id").size()) |
There was a problem hiding this comment.
isn't this the same as:
| assert len(y_filtered) == len(df_filtered.groupby("id").size()) | |
| assert len(y_filtered) == df_filtered.nunique("id") |
There was a problem hiding this comment.
Implemented your suggestion in the last commit.
| min_timeshift=2, | ||
| ) | ||
| # Check fewer rows (core behavior) | ||
| assert len(df_filtered) < len(df_default) |
There was a problem hiding this comment.
As you know the data, it might be better to check the actual len
But using the default df & y, you can check whether the two equal on the intersection
There was a problem hiding this comment.
Added a more robust test in the latest commit, comparing the intersection between default and filtered outputs as suggested. Thanks for the review!
|
CI is failing during installation (pkg_resources missing in build step) across all Python versions. It seems unrelated to the changes in this PR. Happy to help if needed. Thank you! |
|
Yes, correct! There is a PR to fix this problem (#1120). Once it is in, your PR will also succeed to build again. |
|
Thanks again! I have just released v0.21.2 with your feature. |
|
Glad to help! Looking forward to contributing more if something that fits my skills comes up.😁 |
Summary
This PR introduces a
min_timeshiftparameter tomake_forecasting_frameto allow filtering out early time steps in forecasting frame generation.Why
As highlighted in issue #992, 'make_forecasting_frame' was missing a 'min_timeshift' parameters. I saw this issue was still open and implemented the suggested enhancement.
Files changed
tsfresh/utilities/dataframe_functions.py: addedmin_timeshiftfiltering logictests/units/utilities/test_dataframe_functions.py: added unit test formin_timeshiftFunction enhancement
min_timeshiftparameter tomake_forecasting_frame.Testing
pytest)Notes
.gitignoreupdated to exclude.venv/during local developmentFixes #992