coco_pipe.decoding.interfaces#
These protocols define the structural contracts for models and extractors used within the decoding pipeline. Since they are runtime-checkable, the pipeline can verify capabilities without strict inheritance from scikit-learn base classes.
Classes#
Protocol for scikit-learn-compatible decoding estimators. |
|
Interface for pretrained or frozen feature extraction backbones. |
|
Interface for trainable neural estimators with diagnostic metadata. |
Module Contents#
- class coco_pipe.decoding.interfaces.DecoderEstimator#
Bases:
ProtocolProtocol for scikit-learn-compatible decoding estimators.
This interface defines the minimal set of methods required for an estimator to be integrated into the cross-validation engine.
- fit(X, y=None, **fit_params)#
Fit the estimator to the provided data.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Training vector, where n_samples is the number of samples and n_features is the number of features.
y (array-like of shape (n_samples,), optional) – Target values (class labels in classification, real numbers in regression).
**fit_params (dict) – Parameters to pass to the underlying fit method.
- Returns:
self – The fitted estimator.
- Return type:
- predict(X)#
Predict targets for the provided data.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Samples to predict.
- Returns:
y_pred – Predicted target values per sample.
- Return type:
array-like of shape (n_samples,)
- get_params(deep=True)#
Get parameters for this estimator.
- class coco_pipe.decoding.interfaces.EmbeddingExtractor#
Bases:
ProtocolInterface for pretrained or frozen feature extraction backbones.
Embedding extractors typically represent foundation models or frozen neural networks that transform raw data into a fixed-dimensional vector space before classical decoding.
- transform(X)#
Extract features from the provided data.
- Parameters:
X (array-like) – The raw data to be transformed.
- Returns:
embeddings – The extracted feature vectors.
- Return type:
array-like
- class coco_pipe.decoding.interfaces.NeuralTrainable#
Bases:
ProtocolInterface for trainable neural estimators with diagnostic metadata.
This protocol exposes internal training states and histories for reporting and verification purposes.
- get_training_history()#
Get the step-by-step training history (e.g., loss per epoch).
- get_checkpoint_manifest()#
Get information about saved model checkpoints.
- Returns:
manifest – Metadata including checkpoint paths and best-epoch indices.
- Return type:
- get_model_card_info()#
Get high-level model card metadata for the artifact registry.
- Returns:
info – Information about model architecture, training configuration, and hyperparameters.
- Return type:
- get_failure_diagnostics()#
Get technical diagnostics if training failed or diverged.
- Returns:
diagnostics – Information about gradients, NaN detection, or hardware state.
- Return type: