Skip to main content
Version: Beta 🚧

Aggregate

Summary​

The Aggregate class describes an aggregation feature that is applied to a Batch or Stream Feature View via features param.

Example

from tecton import Aggregate, batch_feature_view, TimeWindow
from tecton.types import Int64
from datetime import timedelta
@batch_feature_view(
# ...
features=[
Aggregate(
input_column=Field("my_column", Int64),
function="mean",
time_window=TimeWindow(window_size=timedelta(days=7)),
),
Aggregate(
input_column=Field("another_column", Int64),
function="mean",
time_window=TimeWindow(window_size=timedelta(days=1)),
name="1d_average",
description="my aggregate feature description",
tags={"tag": "value"}
),
],
)
def my_fv(data_source):
pass

Methods​

__init__(...)​

Parameters

  • description (Optional[str]) - A human-readable description of the feature Default: None

  • tags (Optional[Dict[str, str]]) - Tags associated with the feature (key-value pairs of user-defined metadata). Default: None

  • function (AggregationFunction) - One of the built-in aggregation functions, such as "sum", "count", last(2) etc. Default: None

  • time_window (Union[TimeWindow, TimeWindowSeries, LifetimeWindow]) - The window_size and optional offset over which to aggregate over. Default: None

  • name (Optional[str]) - The name of this feature. Defaults to an autogenerated name, e.g. transaction_count_7d_1d. Default: None

  • input_column (Field) - Describes name and type of the column that will be used in the aggregation. Default: None

Was this page helpful?