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)
- Parameters:
lag (
timedelta)size (
timedelta)stride (
timedelta)minimum_coverage (
float)
- __init__(lag: timedelta, size: timedelta, stride: timedelta = timedelta(days=1), minimum_coverage: float = 0.5)[source]#
Initialize a time window with the specified parameters.
- Parameters:
lag (
timedelta) – How far back from the reference point to start the window.size (
timedelta) – The duration of the window.stride (
timedelta) – How much to advance for the next window.minimum_coverage (
float) – Minimum required data coverage (0.0-1.0).lag
size
stride
minimum_coverage
- __str__() str[source]#
Converts to string in ‘(lag=X,size=Y,stride=Z)’ format.
Timedeltas are serialized in ISO 8601 format.
- Return type:
str- 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.
- Parameters:
v (
Union[Self,str,dict[str,Any]]) – Input value to validate (Window, string, or dict)._info (
Any) – Additional validation info (unused).v
_info
- Returns:
Validated Window instance.
- Return type:
Self