Conditional CORAL
neureptrace.decoding.conditional_coral implements pseudo-label class-conditional CORAL for cross-subject transfer.
The protocol is Category 2 / unlabeled target-adaptive. It uses source features and source labels, plus unlabeled target features with pseudo-labels or probability predictions. It does not accept held-out target labels.
Supported pseudo-label sources:
- caller-supplied
target_pseudo_labels, - caller-supplied
target_probabilitiesin source-class order, - a source-trained classifier fitted internally when neither is supplied.
If a pseudo-class has too few confident target rows, the implementation can fall back to global target statistics or raise an error.
neureptrace.decoding.conditional_coral
Pseudo-label conditional CORAL alignment for Category-2 transfer.
The helpers in this module implement a class-conditional CORAL transform for cross-subject M/EEG feature matrices. Source class distributions are aligned toward target pseudo-class distributions estimated from classifier predictions or caller-supplied pseudo-labels/probabilities.
The public API intentionally has no target-label argument. Target rows may be used for pseudo-label adaptation, but held-out target labels must remain reserved for scoring.
ConditionalCoralConfig
dataclass
Configuration for pseudo-label conditional CORAL.
Source code in src/neureptrace/decoding/conditional_coral.py
33 34 35 36 37 38 39 40 41 42 | |
CoralClassStats
dataclass
Class/domain feature statistics used by CORAL.
Source code in src/neureptrace/decoding/conditional_coral.py
45 46 47 48 49 50 51 | |
ConditionalCoralResult
dataclass
Aligned train/test features and pseudo-label provenance.
Source code in src/neureptrace/decoding/conditional_coral.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
fit_pseudo_label_conditional_coral(*, source_features, source_labels, target_features, config=None, estimator=None, target_pseudo_labels=None, target_probabilities=None)
Fit class-conditional CORAL using target pseudo-labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_features
|
Sequence[Sequence[float]] | ndarray
|
Labeled source rows used to estimate source class distributions. |
required |
source_labels
|
Sequence[Sequence[float]] | ndarray
|
Labeled source rows used to estimate source class distributions. |
required |
target_features
|
Sequence[Sequence[float]] | ndarray
|
Unlabeled target rows. They are used to estimate pseudo-class target distributions, but not target labels. |
required |
config
|
ConditionalCoralConfig | Mapping[str, Any] | None
|
Conditional CORAL settings. A mapping is normalized through
:func: |
None
|
estimator
|
BaseEstimator | None
|
Optional sklearn-style source classifier used when neither
|
None
|
target_pseudo_labels
|
Sequence[Any] | ndarray | None
|
Optional classifier-generated target pseudo-labels. These must be in the source class set and are not treated as true target labels. |
None
|
target_probabilities
|
Sequence[Sequence[float]] | ndarray | None
|
Optional target class probabilities in source-class order. Argmax labels become pseudo-labels and max probability becomes pseudo-confidence. |
None
|
Returns:
| Type | Description |
|---|---|
ConditionalCoralResult
|
Source rows aligned class-wise toward pseudo-target class distributions; target rows are returned in their native feature space. |
Notes
This is a Category-2 protocol. The public API intentionally has no
target_labels parameter.
Source code in src/neureptrace/decoding/conditional_coral.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
conditional_coral_config(*, regularization=DEFAULT_CONDITIONAL_CORAL_REGULARIZATION, min_target_rows_per_class=DEFAULT_CONDITIONAL_CORAL_MIN_TARGET_ROWS, confidence_threshold=0.0, fallback='global', center=True, random_state=13)
Normalize public conditional-CORAL options.
Source code in src/neureptrace/decoding/conditional_coral.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
coral_align_features(features, *, source_stats, target_stats, center=True)
Apply CORAL whitening/recoloring from source stats to target stats.
Source code in src/neureptrace/decoding/conditional_coral.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
feature_stats(features, *, regularization=DEFAULT_CONDITIONAL_CORAL_REGULARIZATION)
Return mean and regularized covariance for a feature matrix.
Source code in src/neureptrace/decoding/conditional_coral.py
223 224 225 226 227 228 229 230 231 232 233 234 235 | |
normalize_conditional_coral_fallback(value)
Normalize fallback policy aliases.
Source code in src/neureptrace/decoding/conditional_coral.py
213 214 215 216 217 218 219 220 | |