Search…
Dataset
Feast datasets allow for conveniently saving dataframes that include both features and entities to be subsequently used for data analysis and model training. Data Quality Monitoring was the primary motivation for creating dataset concept.
Dataset's metadata is stored in the Feast registry and raw data (features, entities, additional input keys and timestamp) is stored in the offline store.
Dataset can be created from:
  1. 1.
    Results of historical retrieval
  2. 2.
    [planned] Logging request (including input for on demand transformation) and response during feature serving
  3. 3.
    [planned] Logging features during writing to online store (from batch source or stream)

Creating Saved Dataset from Historical Retrieval

To create a saved dataset from historical features for later retrieval or analysis, a user needs to call get_historical_features method first and then pass the returned retrieval job to create_saved_dataset method. create_saved_dataset will trigger provided retrieval job (by calling .persist() on it) to store the data using specified storage. Storage type must be the same as globally configured offline store (eg, it's impossible to persist data to Redshift with BigQuery source). create_saved_dataset will also create SavedDataset object with all related metadata and will write it to the registry.
1
from feast import FeatureStore
2
from feast.infra.offline_stores.bigquery_source import SavedDatasetBigQueryStorage
3
4
store = FeatureStore()
5
6
historical_job = store.get_historical_features(
7
features=["driver:avg_trip"],
8
entity_df=...,
9
)
10
11
dataset = store.create_saved_dataset(
12
from_=historical_job,
13
name='my_training_dataset',
14
storage=SavedDatasetBigQueryStorage(table_ref='<gcp-project>.<gcp-dataset>.my_training_dataset'),
15
tags={'author': 'oleksii'}
16
)
17
18
dataset.to_df()
Copied!
Saved dataset can be later retrieved using get_saved_dataset method:
1
dataset = store.get_saved_dataset('my_training_dataset')
2
dataset.to_df()
Copied!
Check out our tutorial on validating historical features to see how this concept can be applied in real-world use case.
Export as PDF
Copy link
Edit on GitHub