Window#
- class openstef_beam.evaluation.Window(lag: timedelta, size: timedelta, stride: timedelta = timedelta(days=1), minimum_coverage: float = 0.5)[source]#
Bases:
PydanticStringPrimitiveRepresents a time window with lag, size, and stride parameters.
Used for defining sliding windows for time series analysis with:
lag: How far back from the reference point to start the window
size: The duration of the window
stride: How much to advance for the next window
minimum_coverage: Minimum required data coverage (0.0-1.0)
- __init__(lag: timedelta, size: timedelta, stride: timedelta = timedelta(days=1), minimum_coverage: float = 0.5)[source]#
Initialize a time window with the specified parameters.
- __str__() str[source]#
Converts to string in ‘(lag=X,size=Y,stride=Z)’ format.
Timedeltas are serialized in ISO 8601 format.
- Return type:
- Returns:
String representation of the window parameters.
- classmethod from_string(s: str) Self[source]#
Creates an instance from a string in ‘(lag=X,size=Y,stride=Z)’ format.
- Parameters:
s (
str) – String representation to parse.s
- Returns:
Window instance parsed from the string.
- Raises:
ValueError – If the string format is invalid.
- Return type:
Self
- classmethod validate(v: Self | str | dict[str, Any], _info: Any = None) Self[source]#
Validates and converts various input types to Window.