FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Adding mode='python' for get_historical_features on ODFVs by franciscojavierarceo · Pull Request #4653 · feast-dev/feast · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def __init__(self, udf: FunctionType, udf_string: str = ""):
self.udf_string = udf_string

def transform_arrow(
self, pa_table: pyarrow.Table, features: list[Field]
self,
pa_table: pyarrow.Table,
features: list[Field],
) -> pyarrow.Table:
raise Exception(
'OnDemandFeatureView with mode "python" does not support offline processing.'
)
return pyarrow.Table.from_pydict(self.udf(pa_table.to_pydict()))

def transform(self, input_dict: dict) -> dict:
# Ensuring that the inputs are included as well
Expand Down
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,24 @@ def pandas_view(features_df: pd.DataFrame) -> pd.DataFrame:
assert resp is not None
assert resp["conv_rate_plus_val1"].isnull().sum() == 0

batch_sample["avg_daily_trip_rank_thresholds"] = [
[100, 250, 500, 1000]
] * batch_sample.shape[0]
batch_sample["avg_daily_trip_rank_names"] = [
["Bronze", "Silver", "Gold", "Platinum"]
] * batch_sample.shape[0]
resp_python = self.store.get_historical_features(
entity_df=batch_sample,
features=[
"driver_hourly_stats:conv_rate",
"driver_hourly_stats:acc_rate",
"driver_hourly_stats:avg_daily_trips",
"python_view:conv_rate_plus_acc",
],
).to_df()
assert resp_python is not None
assert resp_python["conv_rate_plus_acc"].isnull().sum() == 0

# Now testing feature retrieval for driver ids not in the dataset
missing_batch_sample = pd.DataFrame([1234567890], columns=["driver_id"])
missing_batch_sample["val_to_add"] = 0
Expand Down

Back | FazBrowse Home | New Git URL