Skip to content

Target Specification

PredictionTargetSpec

from tempora.samplers import PredictionTargetSpec

Targets that are generated according to a prediction or lookahead window.

PredictionTargetSpec(
    window_len: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length,
    window_shift: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length | None = None,
    columns: list[str] | None = None,
    transform_spec: TransformSpec | None = None
)

Parameters

Name Description
window_len Length of the prediction window.
window_shift Optional shift between context window end and target window start.
columns Optional target columns (defaults to all target-capable columns).
transform_spec Optional TransformSpec for target-window transforms.

NextStepAheadTargetSpec

from tempora.samplers import NextStepAheadTargetSpec

Next-step ahead targets (requires the context window to be defined in rows).

NextStepAheadTargetSpec(
    columns: list[str] | None = None,
    transform_spec: TransformSpec | None = None
)

Parameters

Name Description
columns Optional target columns.
transform_spec Optional TransformSpec for target-window transforms.

ContextWindowTargetSpec

from tempora.samplers import ContextWindowTargetSpec

Targets that are generated according to the current context window.

ContextWindowTargetSpec(
    window_len: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length | None = None,
    window_shift: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length | None = None,
    columns: list[str] | None = None,
    transform_spec: TransformSpec | None = None
)

Parameters

Name Description
window_len Optional target window length. Defaults to context length.
window_shift Optional shift between context and target windows.
columns Optional target columns.
transform_spec Optional TransformSpec for target-window transforms.

SeriesTargetSpec

from tempora.samplers import SeriesTargetSpec

Target specification for full-series sampling.

SeriesTargetSpec(
    columns: list[str] | None = None,
    transform_spec: TransformSpec | None = None
)

Parameters

Name Description
columns Optional subset of target columns.
transform_spec Optional TransformSpec for target-window transforms.

TimeToEventTargetSpec

from tempora.samplers import TimeToEventTargetSpec

Time-to-event (TTE) targets.

TimeToEventTargetSpec(
    window_len: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length,
    window_shift: int | float | dt.timedelta | np.timedelta64 | pd.Timedelta | Length | None = None,
    columns: list[str] | None = None,
    transform_spec: TransformSpec | None = None,
    censored: bool = False
)

Parameters

Name Description
window_len Window length for event detection.
window_shift Optional shift between context and target windows.
columns Optional target columns.
transform_spec Optional TransformSpec for target-window transforms.
censored Whether to treat missing events as censored.