vertebrae.extractors.callable
Custom callable feature extractor.
Classes
Wrap a custom Python callable as a feature extractor. |
Module Contents
- class vertebrae.extractors.callable.CallableExtractor(name, transform_fn, fit_fn=None, modality='unknown', extractor_type='custom_callable', recipe_data=None, allow_sparse=True, streaming_safe=False, resource_profile_adapter=None, cache_identity=None)[source]
Wrap a custom Python callable as a feature extractor.
- Parameters:
name (str) – User-facing extractor name.
transform_fn (Callable[[Any], Any]) – Callable that converts inputs into dense or sparse embeddings.
fit_fn (Optional[Callable[[Any, Any], Any]]) – Optional callable invoked during fit.
modality (str) – Input modality metadata.
extractor_type (str) – Extractor family metadata.
recipe_data (Optional[Dict[str, Any]]) – Extra serializable data to include in recipe().
allow_sparse (bool) – Whether sparse transform outputs are allowed.
streaming_safe (bool) – Whether independent batches can be transformed without access to the full dataset.
resource_profile_adapter (Optional[Any])
cache_identity (Optional[str])
- fit(X, y=None)[source]
Fit the callable extractor when a fit function is supplied.
- Parameters:
X (Any) – Input samples.
y (Any) – Optional labels.
- Returns:
This extractor.
- Return type:
- transform(X)[source]
Transform inputs with transform_fn and validate embeddings.
- Parameters:
X (Any) – Input samples.
- Returns:
Dense or sparse numeric embedding matrix.
- Return type:
numpy.ndarray
- fit_transform(X, y=None)[source]
Fit the extractor and transform inputs.
- Parameters:
X (Any) – Input samples.
y (Any) – Optional labels.
- Returns:
Dense or sparse numeric embedding matrix.
- Return type:
numpy.ndarray