neuralset.extractors.base.EventField¶
- pydantic model neuralset.extractors.base.EventField[source][source]¶
Extractor which extracts an int or float attribute from an event.
event_field can be either an attribute of the event or a key in the event.extra dictionary.
- Parameters:
- Fields:
- prepare(obj: DataFrame | Sequence[Event] | Sequence[Segment]) None[source][source]¶
Pre-compute and cache extractor data for a collection of events.
This method triggers
_get_dataon every matching event so that expensive computation (e.g. model inference) is done once and cached. It then calls the extractor on a single event to populate the output shape, which is needed whenallow_missing=True.Call
preparebefore using the extractor in a dataloader.
- get_static(event: Event) Tensor[source][source]¶
Return a single feature vector for the given event.
Override this method in subclasses to produce a static (non-temporal) embedding for one event. The returned tensor should have no time dimension — temporal wrapping is handled by
BaseStaticautomatically.- Parameters:
event (Event) – The event to extract a feature from.
- Returns:
A tensor of shape
(*feature_shape,)(no time axis).- Return type: