Skip to content
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

signal_window_splitter should have an option to keep the remaining data as a smaller window #170

Open
GniLudio opened this issue Oct 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@GniLudio
Copy link

GniLudio commented Oct 16, 2024

Currently the signal_window_splitter only creates windows of full length and discards the rest of the signal.
It would be nice to have an option to create an additional window (of shorter length) with the remaining data.

Example

I have 8 data points and want to create windows of size 3 with 0 overlap.

import tsfel.utils.signal_processing

windows = tsfel.utils.signal_processing.signal_window_splitter(
    signal = [1, 2, 3, 4, 5, 6, 7, 8],
    window_size = 3, 
    overlap = 0
)

Currently this returns 2 windows of size 3 and discards the remaining data:
[[1, 2, 3], [4, 5, 6]]

But it would be nice to have an option to use the remaining data for a window of smaller size:
[[1, 2, 3], [4, 5, 6], [7, 8]]

Feature Request

This could be realized with different one of these parameters:

  • retain_remaining_data: Always uses the remaining data for a window of smaller size.
  • retain_minimum_size: Creates a window of smaller size if the remaining data is more than the retain_minimum_size.

Instead of creating a window of smaller size with the remaining data, it would also be possible to append the remaining data to the last window.

  • retain_append_maximum_size: Append remaining data of smaller size to the last window.

Of course, it would also be nice to have this for functions that use the window splitter. (e.g. the time_series_features_extractor)

@dmfolgado dmfolgado self-assigned this Oct 17, 2024
@dmfolgado dmfolgado added the enhancement New feature or request label Oct 17, 2024
@dmfolgado
Copy link
Member

Hey! I appreciate your suggestion. We haven’t considered that option yet because some features depend on the window size (e.g., peak-related features, signal distance, etc.). We’ll consider integrating it in future versions as long as users are aware of the need to carefully evaluate the results when comparing windows of different lengths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants