coco_pipe.decoding.registry =========================== .. py:module:: coco_pipe.decoding.registry .. autoapi-nested-parse:: Decoding Registry Engine ======================== 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 ---------- .. autoapisummary:: coco_pipe.decoding.registry.EstimatorNotFoundError Functions --------- .. autoapisummary:: coco_pipe.decoding.registry.register_estimator coco_pipe.decoding.registry.register_estimator_spec coco_pipe.decoding.registry.get_estimator_cls coco_pipe.decoding.registry.get_estimator_spec coco_pipe.decoding.registry.get_capabilities coco_pipe.decoding.registry.list_capabilities coco_pipe.decoding.registry.list_estimator_specs coco_pipe.decoding.registry.get_foundation_model_spec coco_pipe.decoding.registry.list_foundation_models coco_pipe.decoding.registry.resolve_estimator_spec coco_pipe.decoding.registry.resolve_estimator_capabilities coco_pipe.decoding.registry.get_selector_capabilities Module Contents --------------- .. py:exception:: EstimatorNotFoundError Bases: :py:obj:`KeyError`, :py:obj:`ValueError` Raised when an estimator is not found in the registry. .. py:function:: register_estimator(name) Decorator to register a custom estimator class under a specific name. :param name: The unique name to register the estimator under. :type name: str :returns: A decorator that adds the class to the internal registry. :rtype: Callable[[Type], Type] .. py:function:: 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. :param spec: The typed specification object for the estimator. :type spec: EstimatorSpec :returns: The registered specification object. :rtype: EstimatorSpec .. seealso:: :py:obj:`get_estimator_spec` Retrieve a registered specification. .. py:function:: get_estimator_cls(name) Retrieve an estimator class by name, triggering lazy loading if needed. :param name: The canonical name of the estimator (e.g., 'LogisticRegression'). :type name: str :returns: The uninstantiated estimator class. :rtype: Type :raises EstimatorNotFoundError: If the estimator is unknown. :raises ImportError: If the underlying module cannot be imported. .. rubric:: Examples >>> from coco_pipe.decoding.registry import get_estimator_cls >>> cls = get_estimator_cls("LogisticRegression") .. seealso:: :py:obj:`get_estimator_spec` Retrieve the metadata for an estimator. .. py:function:: get_estimator_spec(name) Return the typed estimator spec for a given name. :param name: The canonical name of the estimator (e.g., 'LogisticRegression'). :type name: str :returns: The registered specification object. :rtype: EstimatorSpec :raises ValueError: If no specification is registered for the given name. .. seealso:: :py:obj:`get_capabilities` Retrieve derived lightweight capabilities. .. py:function:: get_capabilities(name) Return machine-readable capability metadata for a given estimator. :param name: The canonical name of the estimator. :type name: str :returns: Lightweight metadata summary for validation. :rtype: EstimatorCapabilities .. py:function:: list_capabilities() Return capability metadata for all registered estimators. :returns: A dictionary mapping estimator names to their capability objects. :rtype: Dict[str, EstimatorCapabilities] .. seealso:: :py:obj:`get_capabilities` Retrieve capabilities for a single estimator. .. py:function:: list_estimator_specs() Return all registered estimator specs. :returns: A dictionary mapping estimator names to their full specification objects. :rtype: Dict[str, EstimatorSpec] .. seealso:: :py:obj:`get_estimator_spec` Retrieve a single estimator specification. .. py:function:: 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. .. py:function:: list_foundation_models() Return a list of dicts describing all registered foundation models. .. py:function:: 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). :param config: A configuration object (typically a Pydantic model) containing the 'kind' and specific estimator parameters. :type config: Any :returns: A hydrated spec object containing accurate flags for the training engine. :rtype: EstimatorSpec .. rubric:: Examples >>> from coco_pipe.decoding.configs import LogisticRegressionConfig >>> from coco_pipe.decoding.registry import resolve_estimator_spec >>> config = LogisticRegressionConfig() >>> spec = resolve_estimator_spec(config) .. seealso:: :py:obj:`resolve_estimator_capabilities` Lightweight capability summary. .. py:function:: 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. :param config: The model configuration object. :type config: Any :returns: The resolved capability metadata. :rtype: EstimatorCapabilities .. seealso:: :py:obj:`resolve_estimator_spec` The underlying spec resolution logic. .. py:function:: get_selector_capabilities(method) Return feature-selector capabilities for a given name. :param method: The name of the feature selection method (e.g., 'k_best', 'sfs'). :type method: str :returns: The registered capability metadata for the selector. :rtype: SelectorCapabilities :raises ValueError: If the method name is not found in the SELECTOR_CAPABILITIES registry.