tanat.sequence.type.event package#
Submodules#
tanat.sequence.type.event.entity module#
Event entity implementation.
- class tanat.sequence.type.event.entity.EventEntity(id_value, store: str | Path | SequenceStore, features: list[str] | None = None, *, rank: int, store_index: int, cast_recipe: SequenceCastRecipe | dict | None = None, virtual_id: str | None = None, parent_metadata: SequenceMetadata | None = None)[source]#
Bases:
EntityEntity representing one event row (single timestamp).
tanat.sequence.type.event.pool module#
Event sequence pool implementation.
- tanat.sequence.type.event.pool.Duration = datetime.timedelta | int | float | str[source]#
Type alias for the
durationargument inEventSequencePool.as_interval(). Can be atimedelta/ numeric scalar (applied uniformly) or astrnaming an entity feature column (per-row duration).
- class tanat.sequence.type.event.pool.EventSequencePool(store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None, cast_recipe: SequenceCastRecipe | dict | None = None)[source]#
Bases:
SequencePoolPool of event sequences (single timestamp per entity row).
- SETTINGS_CLASS[source]#
alias of
EventSequenceSettings
- __init__(store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None, cast_recipe: SequenceCastRecipe | dict | None = None) None[source]#
Create an event sequence pool backed by store.
- Parameters:
store – Store path, name, or
SequenceStoreinstance.id_column – User-facing name for the sequence ID column.
time_column – User-facing name for the event timestamp column.
entity_features – Subset of entity feature names to expose.
None→ all available from the store.static_features – Static feature names to expose.
None→ all available.[]→ none.cast_recipe – Optional cast recipe (or dict) applied at read time. Normalised via
SequenceCastRecipe.coerce()and probed eagerly.
- Raises:
TypeError – If cast_recipe is not a
SequenceCastRecipe,dict, orNone.
- as_event() EventSequencePool[source]#
Return this pool unchanged . Source and target types are identical.
A warning is emitted to signal the no-op conversion.
- Returns:
self(no copy, no I/O).
- as_interval(duration: Duration, *, start_column: str = 'start', end_column: str = 'end', destination: str | Path | None = None, overwrite: bool = False) IntervalSequencePool[source]#
Convert this event pool to an interval pool by computing
_t_end.Each event timestamp becomes
_t_start;_t_endis computed as_t_start + duration. The resulting time index is stored as a virtual override (ephemeral) or written to a new persistent store.- Parameters:
duration –
Interval length added to each event timestamp. Can be:
A
timedeltaor numeric scalar: applied uniformly to every event.A
str: name of an entity feature column whose values provide per-row durations.
start_column – User-facing name for the start column. Defaults to
"start".end_column – User-facing name for the end column. Defaults to
"end".destination –
None→ ephemeral result; path → new persistent store.overwrite – Replace destination if it already exists.
- Returns:
A new
IntervalSequencePool.
- as_state(*, end_value: datetime | int | float | str | None = None, start_column: str = 'start', end_column: str = 'end', destination: str | Path | None = None, overwrite: bool = False) StateSequencePool[source]#
Convert this event pool to a state pool by computing
_t_end.Each event timestamp becomes
_t_start;_t_endis taken from the next event in the same sequence (shift(-1).over(_seq_id)).- Parameters:
end_value – Sentinel for
_t_endof the last event per sequence.Noneleaves the last row with_t_end = null. Astrnames a static feature column whose per-sequence value fills the last_t_end.start_column – User-facing name for the start column. Defaults to
"start".end_column – User-facing name for the end column. Defaults to
"end".destination –
None→ ephemeral result; path → new persistent store.overwrite – Replace destination if it already exists.
- Returns:
A new
StateSequencePool.
- classmethod builder() EventSequenceStoreBuilder[source]#
Return a fluent builder for constructing an event sequence store.
tanat.sequence.type.event.sequence module#
Event sequence implementation.
- class tanat.sequence.type.event.sequence.EventSequence(id_value, store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None)[source]#
Bases:
SequenceA single event sequence (one timestamp per entity row).
- SETTINGS_CLASS[source]#
alias of
EventSequenceSettings
- __init__(id_value, store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None) None[source]#
Create an event sequence for id_value.
- Parameters:
id_value – Sequence identifier.
store – Store path, name, or
SequenceStoreinstance.id_column – User-facing name for the sequence ID column.
time_column – User-facing name for the event timestamp column.
entity_features – Subset of entity feature names to expose.
None→ all available from the store.static_features – Static feature names to expose.
None→ all available.[]→ none.
tanat.sequence.type.event.settings module#
Event sequence settings.
- class tanat.sequence.type.event.settings.EventSequenceSettings(*, id_column: str, entity_features: list[str], static_features: list[str] = <factory>, time_column: str)[source]#
Bases:
SequenceSettingsSettings for event sequences (single timestamp column).
Module contents#
Event sequence subtypes.
- class tanat.sequence.type.event.EventEntity(id_value, store: str | Path | SequenceStore, features: list[str] | None = None, *, rank: int, store_index: int, cast_recipe: SequenceCastRecipe | dict | None = None, virtual_id: str | None = None, parent_metadata: SequenceMetadata | None = None)[source]#
Bases:
EntityEntity representing one event row (single timestamp).
- class tanat.sequence.type.event.EventSequence(id_value, store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None)[source]#
Bases:
SequenceA single event sequence (one timestamp per entity row).
- SETTINGS_CLASS[source]#
alias of
EventSequenceSettings
- __init__(id_value, store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None) None[source]#
Create an event sequence for id_value.
- Parameters:
id_value – Sequence identifier.
store – Store path, name, or
SequenceStoreinstance.id_column – User-facing name for the sequence ID column.
time_column – User-facing name for the event timestamp column.
entity_features – Subset of entity feature names to expose.
None→ all available from the store.static_features – Static feature names to expose.
None→ all available.[]→ none.
- class tanat.sequence.type.event.EventSequencePool(store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None, cast_recipe: SequenceCastRecipe | dict | None = None)[source]#
Bases:
SequencePoolPool of event sequences (single timestamp per entity row).
- SETTINGS_CLASS[source]#
alias of
EventSequenceSettings
- __init__(store: str | Path | SequenceStore, *, id_column: str = 'id', time_column: str = 'time', entity_features: list[str] | None = None, static_features: list[str] | None = None, cast_recipe: SequenceCastRecipe | dict | None = None) None[source]#
Create an event sequence pool backed by store.
- Parameters:
store – Store path, name, or
SequenceStoreinstance.id_column – User-facing name for the sequence ID column.
time_column – User-facing name for the event timestamp column.
entity_features – Subset of entity feature names to expose.
None→ all available from the store.static_features – Static feature names to expose.
None→ all available.[]→ none.cast_recipe – Optional cast recipe (or dict) applied at read time. Normalised via
SequenceCastRecipe.coerce()and probed eagerly.
- Raises:
TypeError – If cast_recipe is not a
SequenceCastRecipe,dict, orNone.
- as_event() EventSequencePool[source]#
Return this pool unchanged . Source and target types are identical.
A warning is emitted to signal the no-op conversion.
- Returns:
self(no copy, no I/O).
- as_interval(duration: Duration, *, start_column: str = 'start', end_column: str = 'end', destination: str | Path | None = None, overwrite: bool = False) IntervalSequencePool[source]#
Convert this event pool to an interval pool by computing
_t_end.Each event timestamp becomes
_t_start;_t_endis computed as_t_start + duration. The resulting time index is stored as a virtual override (ephemeral) or written to a new persistent store.- Parameters:
duration –
Interval length added to each event timestamp. Can be:
A
timedeltaor numeric scalar: applied uniformly to every event.A
str: name of an entity feature column whose values provide per-row durations.
start_column – User-facing name for the start column. Defaults to
"start".end_column – User-facing name for the end column. Defaults to
"end".destination –
None→ ephemeral result; path → new persistent store.overwrite – Replace destination if it already exists.
- Returns:
A new
IntervalSequencePool.
- as_state(*, end_value: datetime | int | float | str | None = None, start_column: str = 'start', end_column: str = 'end', destination: str | Path | None = None, overwrite: bool = False) StateSequencePool[source]#
Convert this event pool to a state pool by computing
_t_end.Each event timestamp becomes
_t_start;_t_endis taken from the next event in the same sequence (shift(-1).over(_seq_id)).- Parameters:
end_value – Sentinel for
_t_endof the last event per sequence.Noneleaves the last row with_t_end = null. Astrnames a static feature column whose per-sequence value fills the last_t_end.start_column – User-facing name for the start column. Defaults to
"start".end_column – User-facing name for the end column. Defaults to
"end".destination –
None→ ephemeral result; path → new persistent store.overwrite – Replace destination if it already exists.
- Returns:
A new
StateSequencePool.
- classmethod builder() EventSequenceStoreBuilder[source]#
Return a fluent builder for constructing an event sequence store.
- class tanat.sequence.type.event.EventSequenceSettings(*, id_column: str, entity_features: list[str], static_features: list[str] = <factory>, time_column: str)[source]#
Bases:
SequenceSettingsSettings for event sequences (single timestamp column).