-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Switch from Feature to Field #2514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
93953d5
7057016
8de4c6b
b32bea6
05f2514
58d02c1
ba0f12e
13c874b
1d1e603
1dc0942
02cf8af
d5e391b
57ce182
7f5526f
901a639
bb2fe9d
f93c844
2267064
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,16 +80,16 @@ online_store: | |
| ```python | ||
| # This is an example feature definition file | ||
|
|
||
| from google.protobuf.duration_pb2 import Duration | ||
| from datetime import timedelta | ||
|
|
||
| from feast import Entity, Feature, FeatureView, FileSource, ValueType | ||
| from feast import Entity, FeatureView, Field, FileSource, Float32, Int64, ValueType | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we import the types from a different namespace? To keep things better organized? I'm okay with things the way they are for now but just floating the idea.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah that's a good (non-blocking) idea - I think |
||
|
|
||
| # 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", | ||
| timestamp_field="event_timestamp", | ||
| created_timestamp_column="created", | ||
| ) | ||
|
|
||
|
|
@@ -106,10 +106,10 @@ driver_hourly_stats_view = FeatureView( | |
| name="driver_hourly_stats", | ||
| entities=["driver"], # reference entity by name | ||
| 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), | ||
| schema=[ | ||
| Field(name="conv_rate", dtype=Float32), | ||
| Field(name="acc_rate", dtype=Float32), | ||
| Field(name="avg_daily_trips", dtype=Int64), | ||
| ], | ||
| online=True, | ||
| batch_source=driver_hourly_stats, | ||
|
|
@@ -149,16 +149,16 @@ feast apply | |
| ```python | ||
| # This is an example feature definition file | ||
|
|
||
| from google.protobuf.duration_pb2 import Duration | ||
| from datetime import timedelta | ||
|
|
||
| from feast import Entity, Feature, FeatureView, FileSource, ValueType | ||
| from feast import Entity, FeatureView, Field, FileSource, Float32, Int64, 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", | ||
| timestamp_field="event_timestamp", | ||
| created_timestamp_column="created", | ||
| ) | ||
|
|
||
|
|
@@ -175,10 +175,10 @@ driver_hourly_stats_view = FeatureView( | |
| name="driver_hourly_stats", | ||
| entities=["driver"], # reference entity by name | ||
| 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), | ||
| schema=[ | ||
| Field(name="conv_rate", dtype=Float32), | ||
| Field(name="acc_rate", dtype=Float32), | ||
| Field(name="avg_daily_trips", dtype=Int64), | ||
| ], | ||
| online=True, | ||
| batch_source=driver_hourly_stats, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,8 +18,8 @@ | |
| from google.protobuf.json_format import MessageToJson | ||
| from proto import Message | ||
|
|
||
| from feast.feature import Feature | ||
| from feast.feature_view_projection import FeatureViewProjection | ||
| from feast.field import Field | ||
|
|
||
|
|
||
| class BaseFeatureView(ABC): | ||
|
|
@@ -41,7 +41,7 @@ class BaseFeatureView(ABC): | |
| """ | ||
|
|
||
| name: str | ||
| features: List[Feature] | ||
| features: List[Field] | ||
| description: str | ||
| tags: Dict[str, str] | ||
| owner: str | ||
|
|
@@ -53,8 +53,8 @@ class BaseFeatureView(ABC): | |
| def __init__( | ||
| self, | ||
| *, | ||
| name: Optional[str] = None, | ||
| features: Optional[List[Feature]] = None, | ||
| name: str, | ||
| features: Optional[List[Field]] = None, | ||
| description: str = "", | ||
| tags: Optional[Dict[str, str]] = None, | ||
| owner: str = "", | ||
|
|
@@ -64,7 +64,7 @@ def __init__( | |
|
|
||
| Args: | ||
| name: The unique name of the base feature view. | ||
| features: The list of features defined as part of this base feature view. | ||
| features (optional): The list of features defined as part of this base feature view. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit,
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer |
||
| description (optional): A human-readable description. | ||
| tags (optional): A dictionary of key-value pairs to store arbitrary metadata. | ||
| owner (optional): The owner of the base feature view, typically the email of the | ||
|
|
@@ -73,12 +73,9 @@ def __init__( | |
| Raises: | ||
| ValueError: A field mapping conflicts with an Entity or a Feature. | ||
| """ | ||
| if not name: | ||
| raise ValueError("Name needs to be provided") | ||
|
Comment on lines
76
to
77
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason this was removed?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's a bit unnecessary since this initialization happens only internally; the check should still happen so I'm going to switch to an |
||
| assert name is not None | ||
| self.name = name | ||
|
|
||
| self.features = features or [] | ||
|
|
||
| self.description = description | ||
| self.tags = tags or {} | ||
| self.owner = owner | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.