temporian.EventSet.leak #
leak(duration: Duration) -> EventSetOrNode
Subtracts a duration from an EventSet
's
timestamps.
In other words, shifts the timestamp values backward in time.
Note that this operator moves future data into the past, and should be used with caution to prevent unwanted future leakage. For instance, this op should generally not be used to compute the input features of a model.
Usage example
>>> a = tp.event_set(
... timestamps=[0, 1, 5, 6],
... features={"value": [0, 1, 5, 6]},
... )
>>> b = a.leak(tp.duration.seconds(2))
>>> b
indexes: ...
(4 events):
timestamps: [-2. -1. 3. 4.]
'value': [0 1 5 6]
...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration |
Duration
|
Duration to leak by. |
required |
Returns:
Type | Description |
---|---|
EventSetOrNode
|
Leaked EventSet. |