generate_autocorr_lags#
- openstef_models.transforms.time_domain.lags_adder.generate_autocorr_lags(signal: Series, min_horizon: timedelta, height_threshold: float = 0.1, max_lag_hours: int = 4) list[timedelta][source]#
Generate lag features based on autocorrelation peaks in the time series.
Analyzes the autocorrelation function of the input data to identify significant patterns. Peaks in the autocorrelation curve indicate time delays where the signal is similar to itself, suggesting useful lag features.
- Parameters:
signal (
Series) – Time series data to analyze (typically the target variable).min_horizon (
timedelta) – Minimum forecast horizon - only lags >= this will be included.height_threshold (
float) – Minimum autocorrelation value to recognize as a peak. Higher values = fewer, more significant peaks. Default 0.1.max_lag_hours (
int) – Maximum lag time in hours to search for peaks. Default 4 hours.signal
min_horizon
height_threshold
max_lag_hours
- Returns:
List of lag timedeltas corresponding to autocorrelation peaks, filtered by min_horizon. Returns empty list if scipy is not available, data is insufficient, or has no variance.
- Return type: