coco_pipe.decoding.registry#

Central engine for resolving, registering, and lazy-loading decoding estimators. This allows configurations to refer to models by name without triggering eager imports of heavyweight dependencies.

Exceptions#

EstimatorNotFoundError

Raised when an estimator is not found in the registry.

Functions#

register_estimator(name)

Decorator to register a custom estimator class under a specific name.

register_estimator_spec(spec)

Register or replace an estimator spec in the global specs registry.

get_estimator_cls(name)

Retrieve an estimator class by name, triggering lazy loading if needed.

get_estimator_spec(name)

Return the typed estimator spec for a given name.

get_capabilities(name)

Return machine-readable capability metadata for a given estimator.

list_capabilities()

Return capability metadata for all registered estimators.

list_estimator_specs()

Return all registered estimator specs.

get_foundation_model_spec(model_key)

Return the FoundationModelSpec for a registered foundation model.

list_foundation_models()

Return a list of dicts describing all registered foundation models.

resolve_estimator_spec(config)

Resolve a hydrated EstimatorSpec from a model configuration.

resolve_estimator_capabilities(config)

Resolve lightweight capabilities derived from resolve_estimator_spec.

get_selector_capabilities(method)

Return feature-selector capabilities for a given name.

Module Contents#

exception coco_pipe.decoding.registry.EstimatorNotFoundError#

Bases: KeyError, ValueError

Raised when an estimator is not found in the registry.

coco_pipe.decoding.registry.register_estimator(name)#

Decorator to register a custom estimator class under a specific name.

Parameters:

name (str) – The unique name to register the estimator under.

Returns:

A decorator that adds the class to the internal registry.

Return type:

Callable[[Type], Type]

coco_pipe.decoding.registry.register_estimator_spec(spec)#

Register or replace an estimator spec in the global specs registry.

This allows the execution engine to support new model types by name, defining their capabilities, required input formats, and importance extraction logic.

Parameters:

spec (EstimatorSpec) – The typed specification object for the estimator.

Returns:

The registered specification object.

Return type:

EstimatorSpec

See also

get_estimator_spec

Retrieve a registered specification.

coco_pipe.decoding.registry.get_estimator_cls(name)#

Retrieve an estimator class by name, triggering lazy loading if needed.

Parameters:

name (str) – The canonical name of the estimator (e.g., ‘LogisticRegression’).

Returns:

The uninstantiated estimator class.

Return type:

Type

Raises:

Examples

>>> from coco_pipe.decoding.registry import get_estimator_cls
>>> cls = get_estimator_cls("LogisticRegression")

See also

get_estimator_spec

Retrieve the metadata for an estimator.

coco_pipe.decoding.registry.get_estimator_spec(name)#

Return the typed estimator spec for a given name.

Parameters:

name (str) – The canonical name of the estimator (e.g., ‘LogisticRegression’).

Returns:

The registered specification object.

Return type:

EstimatorSpec

Raises:

ValueError – If no specification is registered for the given name.

See also

get_capabilities

Retrieve derived lightweight capabilities.

coco_pipe.decoding.registry.get_capabilities(name)#

Return machine-readable capability metadata for a given estimator.

Parameters:

name (str) – The canonical name of the estimator.

Returns:

Lightweight metadata summary for validation.

Return type:

EstimatorCapabilities

coco_pipe.decoding.registry.list_capabilities()#

Return capability metadata for all registered estimators.

Returns:

A dictionary mapping estimator names to their capability objects.

Return type:

Dict[str, EstimatorCapabilities]

See also

get_capabilities

Retrieve capabilities for a single estimator.

coco_pipe.decoding.registry.list_estimator_specs()#

Return all registered estimator specs.

Returns:

A dictionary mapping estimator names to their full specification objects.

Return type:

Dict[str, EstimatorSpec]

See also

get_estimator_spec

Retrieve a single estimator specification.

coco_pipe.decoding.registry.get_foundation_model_spec(model_key)#

Return the FoundationModelSpec for a registered foundation model.

Raises:

KeyError – If model_key is not a registered foundation model.

Parameters:

model_key (str)

Return type:

coco_pipe.decoding._specs.FoundationModelSpec

coco_pipe.decoding.registry.list_foundation_models()#

Return a list of dicts describing all registered foundation models.

Return type:

list[dict]

coco_pipe.decoding.registry.resolve_estimator_spec(config)#

Resolve a hydrated EstimatorSpec from a model configuration.

This function handles polymorphic model types (Foundation, Temporal, Neural) and applies runtime parameter fixups based on the user’s specific configuration (e.g., handling SVC probability flags).

Parameters:

config (Any) – A configuration object (typically a Pydantic model) containing the ‘kind’ and specific estimator parameters.

Returns:

A hydrated spec object containing accurate flags for the training engine.

Return type:

EstimatorSpec

Examples

>>> from coco_pipe.decoding.configs import LogisticRegressionConfig
>>> from coco_pipe.decoding.registry import resolve_estimator_spec
>>> config = LogisticRegressionConfig()
>>> spec = resolve_estimator_spec(config)

See also

resolve_estimator_capabilities

Lightweight capability summary.

coco_pipe.decoding.registry.resolve_estimator_capabilities(config)#

Resolve lightweight capabilities derived from resolve_estimator_spec.

This is a convenience wrapper that first resolves the full spec (handling polymorphism and runtime fixups) and then converts it to the capability summary used by the engine for validation.

Parameters:

config (Any) – The model configuration object.

Returns:

The resolved capability metadata.

Return type:

EstimatorCapabilities

See also

resolve_estimator_spec

The underlying spec resolution logic.

coco_pipe.decoding.registry.get_selector_capabilities(method)#

Return feature-selector capabilities for a given name.

Parameters:

method (str) – The name of the feature selection method (e.g., ‘k_best’, ‘sfs’).

Returns:

The registered capability metadata for the selector.

Return type:

SelectorCapabilities

Raises:

ValueError – If the method name is not found in the SELECTOR_CAPABILITIES registry.