Feature Stores
zenml.feature_stores
A feature store enables an offline and online serving of feature data.
Feature stores allow data teams to serve data via an offline store and an online low-latency store where data is kept in sync between the two. It also offers a centralized registry where features (and feature schemas) are stored for use within a team or wider organization.
As a data scientist working on training your model, your requirements for how you access your batch / 'offline' data will almost certainly be different from how you access that data as part of a real-time or online inference setting. Feast solves the problem of developing train-serve skew where those two sources of data diverge from each other.
Attributes
__all__ = ['BaseFeatureStore']
module-attribute
Classes
BaseFeatureStore(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: StackComponent
, ABC
Base class for all ZenML feature stores.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
Attributes
config: BaseFeatureStoreConfig
property
Returns the BaseFeatureStoreConfig
config.
Returns:
Type | Description |
---|---|
BaseFeatureStoreConfig
|
The configuration. |
Functions
get_historical_features(entity_df: Any, features: List[str], full_feature_names: bool = False) -> Any
abstractmethod
Returns the historical features for training or batch scoring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_df
|
Any
|
The entity DataFrame or entity name. |
required |
features
|
List[str]
|
The features to retrieve. |
required |
full_feature_names
|
bool
|
Whether to return the full feature names. |
False
|
Returns:
Type | Description |
---|---|
Any
|
The historical features. |
Source code in src/zenml/feature_stores/base_feature_store.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
get_online_features(entity_rows: List[Dict[str, Any]], features: List[str], full_feature_names: bool = False) -> Dict[str, Any]
abstractmethod
Returns the latest online feature data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_rows
|
List[Dict[str, Any]]
|
The entity rows to retrieve. |
required |
features
|
List[str]
|
The features to retrieve. |
required |
full_feature_names
|
bool
|
Whether to return the full feature names. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The latest online feature data as a dictionary. |
Source code in src/zenml/feature_stores/base_feature_store.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
Modules
base_feature_store
The base class for feature stores.
Classes
BaseFeatureStore(name: str, id: UUID, config: StackComponentConfig, flavor: str, type: StackComponentType, user: Optional[UUID], created: datetime, updated: datetime, labels: Optional[Dict[str, Any]] = None, connector_requirements: Optional[ServiceConnectorRequirements] = None, connector: Optional[UUID] = None, connector_resource_id: Optional[str] = None, *args: Any, **kwargs: Any)
Bases: StackComponent
, ABC
Base class for all ZenML feature stores.
Source code in src/zenml/stack/stack_component.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
config: BaseFeatureStoreConfig
property
Returns the BaseFeatureStoreConfig
config.
Returns:
Type | Description |
---|---|
BaseFeatureStoreConfig
|
The configuration. |
get_historical_features(entity_df: Any, features: List[str], full_feature_names: bool = False) -> Any
abstractmethod
Returns the historical features for training or batch scoring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_df
|
Any
|
The entity DataFrame or entity name. |
required |
features
|
List[str]
|
The features to retrieve. |
required |
full_feature_names
|
bool
|
Whether to return the full feature names. |
False
|
Returns:
Type | Description |
---|---|
Any
|
The historical features. |
Source code in src/zenml/feature_stores/base_feature_store.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
get_online_features(entity_rows: List[Dict[str, Any]], features: List[str], full_feature_names: bool = False) -> Dict[str, Any]
abstractmethod
Returns the latest online feature data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_rows
|
List[Dict[str, Any]]
|
The entity rows to retrieve. |
required |
features
|
List[str]
|
The features to retrieve. |
required |
full_feature_names
|
bool
|
Whether to return the full feature names. |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The latest online feature data as a dictionary. |
Source code in src/zenml/feature_stores/base_feature_store.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
BaseFeatureStoreConfig(warn_about_plain_text_secrets: bool = False, **kwargs: Any)
Bases: StackComponentConfig
Base config for feature stores.
Source code in src/zenml/stack/stack_component.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
BaseFeatureStoreFlavor
Bases: Flavor
Base class for all ZenML feature store flavors.
config_class: Type[BaseFeatureStoreConfig]
property
Config class for this flavor.
Returns:
Type | Description |
---|---|
Type[BaseFeatureStoreConfig]
|
The config class. |
implementation_class: Type[BaseFeatureStore]
abstractmethod
property
type: StackComponentType
property