FeatureStore#

Defined in: voxatlas.pipeline.feature_store

class voxatlas.pipeline.feature_store.FeatureStore[source]#

Bases: object

Store intermediate and final feature outputs for one pipeline run.

The feature store is the shared lookup table used during dependency resolution. Extractors read dependency outputs from this object instead of recomputing upstream features.

Examples

>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> store = FeatureStore()
>>> store.add("acoustic.pitch.f0", {"value": 123})
>>> store.exists("acoustic.pitch.f0")
True
add(feature_name, result)[source]#

Add a computed output to the store.

Parameters:
  • feature_name (str) – Fully qualified feature name.

  • result (object) – Output object returned by an extractor.

Returns:

The store is updated in place.

Return type:

None

Notes

Adding the same feature name again overwrites the previous value.

Examples

>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> store = FeatureStore()
>>> store.add("syntax.dependencies", {"edges": []})
get(feature_name)[source]#

Retrieve a stored feature output.

Parameters:

feature_name (str) – Fully qualified feature name.

Returns:

Stored feature output.

Return type:

object

Raises:

KeyError – Raised when the feature is not present.

Examples

>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> store = FeatureStore()
>>> store.add("syntax.dependencies", {"edges": []})
>>> store.get("syntax.dependencies")
{'edges': []}
exists(feature_name)[source]#

Check whether a feature has already been stored.

Parameters:

feature_name (str) – Fully qualified feature name.

Returns:

True when the feature exists in the store.

Return type:

bool

Examples

>>> from voxatlas.pipeline.feature_store import FeatureStore
>>> store = FeatureStore()
>>> store.exists("lexical.frequency.lookup")
False