Skip to main content
Version: 1.1

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

For a list of available aggregation functions, see Aggregation Functions.

Methods​

__init__(...)​

Parameters

  • description: Optional[str] = None A human-readable description of the feature
  • tags: Optional[Dict[str, str]] = None Tags associated with the feature (key-value pairs of user-defined metadata).
  • function: AggregationFunction = None One of the built-in aggregation functions, such as "sum", "count", last(2) etc.
  • time_window: Union[TimeWindow, TimeWindowSeries, LifetimeWindow] = None The window_size and optional offset over which to aggregate over.
  • name: Optional[str] = None The name of this feature. Defaults to an autogenerated name, e.g. transaction_count_7d_1d.
  • input_column: Field = None Describes name and type of the column that will be used in the aggregation.

Was this page helpful?