Seamlessly Integrate Feature Stores into ML Pipelines with Feast and ZenML
Enhance your machine learning workflows by integrating Feast, a powerful feature store, with ZenML. This integration enables efficient management and serving of features for model training and inference, streamlining the ML pipeline process.
Features with ZenML
- Seamless integration of Feast feature stores into ZenML pipelines
- Access to historical feature data for model training
- Simplified feature retrieval and management within ML workflows
- Improved collaboration and reproducibility across teams
Main Features
- Unified serving of features to models for training and inference
- Scalable offline store for batch scoring and model training
- Integration with various data sources and platforms
- Centralized feature registry and versioning
How to use ZenML with
Feast
# First register the feature store and a stack
# zenml feature-store register feast_store --flavor=feast --feast_repo="<PATH/TO/FEAST/REPO>"
# zenml stack register ... -f feast_store
from zenml import step, pipeline
from zenml.client import Client
@step
def get_historical_features(
entity_dict, features, full_feature_names=False
):
feature_store = Client().active_stack.feature_store
entity_df = pd.DataFrame.from_dict(entity_dict)
return feature_store.get_historical_features(
entity_df=entity_df,
features=features,
full_feature_names=full_feature_names,
)
@pipeline
def my_pipeline():
my_features = get_historical_features(
entity_dict={"driver_id": [1001, 1002, 1003]},
features=["driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate"]
)
# use features in downstream steps
# also use the CLI for Feast metadata etc
# zenml feature-store feature get-entities
# zenml feature-store feature get-data-sources
# ...
The code example demonstrates how to retrieve historical features from a Feast feature store within a ZenML pipeline step. It uses the get_historical_features method to fetch features based on the provided entity dictionary and feature list, enabling seamless integration of feature store data into the ML workflow.
Additional Resources
Read Feast Integration Documentation
Feast Official Documentation
Blog Post: “Building an Efficient and Scalable MLOps Workflow with Feast and ZenML”