coco_pipe.decoding.registry

Central registry for decoding estimators (classifiers, regressors, and FMs). This allows instantiating models from string names in configuration files, avoiding circular imports and simplifying the config layer.

Usage

>>> from coco_pipe.decoding.registry import register_estimator, get_estimator_cls
>>>
>>> @register_estimator("MyModel")
>>> class MyModel: ...
>>>
>>> cls = get_estimator_cls("MyModel")

Attributes

Functions

_discover_entry_points()

Populate _LAZY_MODULES from 'coco_pipe.estimators' entry points.

_discover_internal_modules()

Walk through the 'coco_pipe.decoding' subpackage and import all modules.

register_estimator(→ Callable[[Type], Type])

Decorator to register an estimator class under a specific name.

get_estimator_cls(→ Type)

Retrieve an estimator class by name.

list_estimators(→ Dict[str, Type])

Return a copy of the current registry.

Module Contents

coco_pipe.decoding.registry._ESTIMATOR_REGISTRY: Dict[str, Type]
coco_pipe.decoding.registry._LAZY_MODULES
coco_pipe.decoding.registry._discover_entry_points()[source]

Populate _LAZY_MODULES from ‘coco_pipe.estimators’ entry points. This allows plugins to register estimators without modifying code.

coco_pipe.decoding.registry._discover_internal_modules()[source]

Walk through the ‘coco_pipe.decoding’ subpackage and import all modules. This triggers the @register_estimator decorators.

coco_pipe.decoding.registry.register_estimator(name: str) Callable[[Type], Type][source]

Decorator to register an estimator class under a specific name.

Parameters:

name (str) – The unique alias for the estimator (e.g., “RandomForestClassifier”).

coco_pipe.decoding.registry.get_estimator_cls(name: str) Type[source]

Retrieve an estimator class by name.

Parameters:

name (str) – Name of the estimator.

Returns:

The class object.

Return type:

Type

Raises:

ValueError – If name is not found.

coco_pipe.decoding.registry.list_estimators() Dict[str, Type][source]

Return a copy of the current registry.