deepof.utils.extract_windows

deepof.utils.extract_windows(to_window: deepof_table_dict, window_size: int, window_step: int, save_as_paths: bool = False, shuffle: bool = False, aggregate: str | None = None, windows_desc: str = 'Get windows') ndarray

Apply the rupture method independently to each experiment, and concatenate into a single dataset at the end.

Returns a dataset and the rupture indices, adapted to be used in a concatenated version of the labels.

Parameters:
  • to_window (table_dict) – table_dict with all experiments.

  • window_size (int) – specifies the length of the sliding window.

  • window_step (int) – specifies the stride of the sliding window.

  • save_as_paths (bool) – save result as paths in dictionary instead of keeping it in RAM

  • shuffle (bool) – Whether to shuffle the data for each dataset. Defaults to False.

  • aggregate (str) – Aggregate Instead of extracting full windows. Extracts full windows if none (default), otherwise options are: “mean” : average windows to one value “mid” : take middle of windows as window value “wta” : winner takes all: whatever behavior or behavior combination is the most frequent is set as teh window value “lta” : loser takes all: whatever behavior or behavior combination is the rarest is set as teh window value

  • windows_desc (str) – Progress bar label

Returns:

Dictionary containing stacks of windowed data samples for each table. Shape of the stacks: [N_samples, window_size, N_features] output_shape (Tuple): shape of the output array (N_samples, window_size, N_features).

Return type:

to_window (dict)