Is it possible to fetch multiple features from feast feature-store in a single request?

599 views Asked by At

In use-cases like search one might need to apply a model to multiple entries at runtime. Having a single query is much more resilient than one per product. Does feast support it?

1

There are 1 answers

1
skt7 On

In this scenario, the "feature service" component of the Feast can be utilized to pull data from one or more feature views. This makes it possible to fetch multiple features in a single call.

For example, let's say we have multiple feature views -

  1. Feature view for demographics data
demographics_fv = FeatureView(
    name="demographics_fv",
    entities=[cust_id],
    ttl=timedelta(days=365),
    schema=[
        Field(name="gender", dtype=String),
        Field(name="age", dtype=Int32),
        Field(name="location", dtype=String),
    ],
    online=True,
    source=cust_data,
    tags={}
)
  1. Feature view for medical data
medical_fv = FeatureView(
    name="medical_fv",
    entities=[cust_id],
    ttl=timedelta(days=365),
    schema=[
        Field(name="weight", dtype=Int32),
        Field(name="height", dtype=Int32),
        Field(name="blood_group", dtype=String),
    ],
    online=True,
    source=cust_data,
    tags={}
)

A feature service definition can be created that will consist references to multiple feature views -

cust_data_fs = FeatureService(
    name="cust_data_fs",
    features=[demographics_fv, medical_fv[["weight", "height"]]]
)

Now a call can be made to this feature service to retrieve required data that may be coming from one or more feature views -

feature_service = feature_store.get_feature_service("cust_data_fs")
feature_store.get_historical_features(features=feature_service, entity_df=entity_df)

You can find more details on this link: https://docs.feast.dev/getting-started/concepts/feature-retrieval#feature-services