Search…
Read features from the online store
The Feast Python SDK allows users to retrieve feature values from an online store. This API is used to look up feature values at low latency during model serving in order to make online predictions.
Online stores only maintain the current state of features, i.e latest feature values. No historical data is stored or served.

Retrieving online features

1. Ensure that feature values have been loaded into the online store

Please ensure that you have materialized (loaded) your feature values into the online store before starting

2. Define feature references

Create a list of features that you would like to retrieve. This list typically comes from the model training step and should accompany the model binary.
1
features = [
2
"driver_hourly_stats:conv_rate",
3
"driver_hourly_stats:acc_rate"
4
]
Copied!

3. Read online features

Next, we will create a feature store object and call get_online_features() which reads the relevant feature values directly from the online store.
1
fs = FeatureStore(repo_path="path/to/feature/repo")
2
online_features = fs.get_online_features(
3
features=features,
4
entity_rows=[
5
{"driver_id": 1001},
6
{"driver_id": 1002}]
7
).to_dict()
Copied!
1
{
2
"driver_hourly_stats__acc_rate":[
3
0.2897740304470062,
4
0.6447265148162842
5
],
6
"driver_hourly_stats__conv_rate":[
7
0.6508077383041382,
8
0.14802511036396027
9
],
10
"driver_id":[
11
1001,
12
1002
13
]
14
}
Copied!
Last modified 20d ago