-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathtest_fetch_gcp.py
More file actions
25 lines (21 loc) · 938 Bytes
/
test_fetch_gcp.py
File metadata and controls
25 lines (21 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from feast import FeatureStore, RepoConfig
from feast.repo_config import RegistryConfig
# TODO: replace with your bucket
repo_config = RepoConfig(
registry=RegistryConfig(path="gs://feast-workshop-danny/registry.pb"),
project="feast_demo_gcp",
provider="gcp",
offline_store="file", # Could also be the OfflineStoreConfig e.g. FileOfflineStoreConfig
online_store="null", # Could also be the OnlineStoreConfig e.g. RedisOnlineStoreConfig
)
store = FeatureStore(config=repo_config)
import pandas as pd
# Get the latest feature values for unique entities
entity_df = pd.DataFrame.from_dict({"driver_id": [1001, 1002, 1003, 1004, 1005],})
entity_df["event_timestamp"] = pd.to_datetime("now", utc=True)
training_df = store.get_historical_features(
entity_df=entity_df, features=store.get_feature_service("model_v2"),
).to_df()
# Make batch predictions
# predictions = model.predict(training_df)
print(training_df)