transform¶
- class SlidingWindowAggregator(metric_funcs, window_size, window_slices=None)¶
Bases:
BaseEstimator,TransformerMixinSliding window aggregator for time series data.
- Parameters:
See also
get_window_slices()to obtain window size(s) and corresponding slices.- fit(X, y=None)¶
This method is required by the sklearn API and does not perform any actual fitting.
- get_feature_names_out(input_features=None)¶
Get output feature names for transformation.
- transform(X)¶
Transform the input data by applying the metric functions to sliding windows. The transformed data is returned as a 2D array, flattened along all axes except the first.
- get_window_slices(num_windows_per_scale, *, time_scales=None, durations=None, time_scale_quantiles=None)¶
Find consecutive window slices for time scales, either explicitly specified or derived from durations and quantiles.
- Parameters:
num_windows_per_scale (
int) – Number of windows per time scale.time_scales (
Iterable[int] |None, default:None) – Explicit time scales.durations (
ndarray|None, default:None) – Durations to calculate time scales from.time_scale_quantiles (
Iterable[float] |None, default:None) – Quantiles of the durations to derive time scales.
- Return type:
- Returns:
A tuple containing the (adjusted) time scales and the corresponding window slices.
- Raises:
ValueError – If neither
time_scalesnordurationsandtime_scale_quantilesare specified.ValueError – If
time_scale_quantilesare specified butdurationsare not.