docs/adr/ADR-0001-feature-services.md
Accepted
Feast's Feature Views allowed for storage-level grouping of features based on how they are produced. However, there was no concept of a retrieval-level grouping of features that maps to models. Without this:
Introduce a FeatureService object that allows users to define which features to use for a specific ML use case. A feature service groups features from one or more feature views for model training and online serving.
Feature services use a Pandas-like API where feature views can be referenced directly:
from feast import FeatureService
feature_service = FeatureService(
name="my_model_v1",
features=[
shop_raw, # select all features
customer_sales[["average_order_value", "max_order_value"]], # select specific features
],
)
Feature selection with aliasing:
feature_service = FeatureService(
name="my_model_v1",
features=[
shop_raw,
customer_sales[["average_order_value", "max_order_value"]]
.alias({"average_order_value": "avg_o_val"}),
],
)
# Online inference
row = store.get_online_features(
feature_service="my_model_v1",
entity_rows=[{"customer_id": 123, "shop_id": 456}],
).to_dict()
# Training
historical_df = store.get_historical_features(
feature_service="my_model_v1",
entity_df=entity_df,
)
FeatureService was chosen over FeatureSet because it conveys the concept of a serving layer bridging models and data. FeatureService is analogous to model services in model serving systems.sdk/python/feast/feature_service.py