lamindb.models.FeatureManager

class lamindb.models.FeatureManager(host)

Bases: object

Feature manager.

Attributes

property slots: dict[str, Schema]

Schema by slot.

Example

>>> artifact.features.slots
{'var': <Schema: var>, 'obs': <Schema: obs>}

Class methods

classmethod filter(**expression)

Query artifacts by features.

Return type:

QuerySet

classmethod get(**expression)

Query a single artifact by feature.

Return type:

Record

Methods

add_feature_set(schema, slot)
Return type:

None

add_schema(schema, slot)
Return type:

None

add_values(values, feature_field=FieldAttr(Feature.name), str_as_ulabel=True)

Curate artifact with features & values.

Parameters:
  • values (dict[str, str | int | float | bool]) – A dictionary of keys (features) & values (labels, numbers, booleans).

  • feature_field (DeferredAttribute, default: FieldAttr(Feature.name)) – The field of a reference registry to map keys of the dictionary.

  • str_as_ulabel (bool, default: True) – Whether to interpret string values as ulabels.

Return type:

None

get_values()

Get feature values as a dictionary.

Return type:

dict[str, Any]

make_external(feature)

Make a feature external, aka, remove feature from feature sets.

Parameters:

feature (Feature) – Feature A feature record.

Return type:

None

remove_values(feature, *, value=None)

Remove value annotations for a given feature.

Parameters:
  • feature (str | Feature) – The feature for which to remove values.

  • value (Any | None, default: None) – An optional value to restrict removal to a single value.