Skip to main content
Version: 0.9

LifetimeWindow

Private Preview

This feature is currently in Private Preview.

This feature has the following limitations:
  • Must be enabled by Tecton Support.
If you would like to participate in the preview, please file a feature request.

Summary​

This class describes a LifetimeWindow that is applied in an Aggregation within a Batch or Stream Feature View.

Lifetime Windows are useful for expressing a feature like "user transaction average since Jan 1, 2000."

For an overview of Aggregation Windows, check out Aggregation Windows.

Description​

Tecton Aggregations are applied over a specified time window using the time_window parameter. Use LifetimeWindow to create an Aggregation over a window that continuously expands.

from tecton import batch_feature_view, FilteredSource, Aggregation, TimeWindow


@batch_feature_view(
sources=[FilteredSource(transactions)],
mode="spark_sql",
entities=[user],
aggregation_interval=timedelta(days=1),
compaction_enabled=True,
lifetime_start_time=datetime(2000, 1, 1),
aggregations=[Aggregation(column="amount", function="mean", time_window=LifetimeWindow())],
)
def user_average_transaction_amount(transactions):
return f"""
SELECT user_id, timestamp, amount
FROM {transactions}
"""

The start time of this window is Jan 1, 2000 (as specified by lifetime_start_time). The end time of this window will be the most recent aggregation interval as of an incoming online feature request or training event timestamp (during offline feature retrieval).

Was this page helpful?

🧠 Hi! Ask me anything about Tecton!

Floating button icon