-
-
Save nl-2021/941564faab996010c4be276cc8ccc938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an example feature definition file | |
from google.protobuf.duration_pb2 import Duration | |
from feast import Entity, Feature, FeatureView, FileSource, ValueType | |
# Read data from parquet files. Parquet is convenient for local development mode. For | |
# production, you can use your favorite DWH, such as BigQuery. See Feast documentation | |
# for more info. | |
driver_hourly_stats = FileSource( | |
path="/content/feature_repo/data/driver_stats.parquet", | |
event_timestamp_column="event_timestamp", | |
created_timestamp_column="created", | |
) | |
# Define an entity for the driver. You can think of entity as a primary key used to | |
# fetch features. | |
driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id",) | |
# Our parquet files contain sample data that includes a driver_id column, timestamps and | |
# three feature column. Here we define a Feature View that will allow us to serve this | |
# data to our model online. | |
driver_hourly_stats_view = FeatureView( | |
name="driver_hourly_stats", | |
entities=["driver_id"], | |
ttl=Duration(seconds=86400 * 1), | |
features=[ | |
Feature(name="conv_rate", dtype=ValueType.FLOAT), | |
Feature(name="acc_rate", dtype=ValueType.FLOAT), | |
Feature(name="avg_daily_trips", dtype=ValueType.INT64), | |
], | |
online=True, | |
batch_source=driver_hourly_stats, | |
tags={}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment