Unlabeled anchor alignment
neureptrace.decoding.unlabeled_anchor_alignment implements a clean Category 2 / unlabeled target-adaptive alignment protocol for shared calibration anchors.
Use this when source subjects and the held-out target subject share a label-free calibration axis, for example:
- movie time bins,
- stimulus identifiers,
- event identifiers,
- resting-state segment ids,
- other external anchors that are not the decoded target labels.
The target projection is fitted from target calibration features and their anchor ids, then applied to separate target test rows. The API intentionally has no target_labels argument. Passing decoded class labels as anchors would no longer be an ordinary Category-2 claim.
neureptrace.decoding.unlabeled_anchor_alignment
Unlabeled anchor calibration for Category-2 cross-subject alignment.
This module implements the clean deployment version of hyperalignment-like target calibration: source subjects and the held-out target subject share an external, label-free calibration axis such as movie time points, stimulus identifiers, or resting-state segment ids. Source and target projections are fitted from those anchors, a source-label classifier can then be trained in the shared latent space, and target test rows are transformed without using target class labels.
The public API intentionally has no target_labels argument. Passing decoded
class labels as anchors would violate the intended Category-2 interpretation and
should be reported as supervised calibration outside this module.
AnchorProjection
dataclass
Linear projection from one subject/domain into an anchor template.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
30 31 32 33 34 35 36 37 38 39 | |
UnlabeledAnchorAlignmentResult
dataclass
Aligned source and target features plus Category-2 provenance.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
42 43 44 45 46 47 48 49 50 51 52 | |
fit_unlabeled_anchor_alignment(*, source_features, source_domains, source_anchor_values, target_calibration_features, target_calibration_anchor_values, target_test_features, n_components=DEFAULT_UNLABELED_ANCHOR_COMPONENTS, regularization=DEFAULT_UNLABELED_ANCHOR_REGULARIZATION, min_common_anchors=2)
Fit source and target projections from shared unlabeled anchors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_features
|
Sequence[Sequence[float]] | ndarray
|
Source feature rows pooled across source subjects/domains. |
required |
source_domains
|
Sequence[Hashable] | ndarray
|
One source-domain identifier per source row, typically subject id. |
required |
source_anchor_values
|
Sequence[Hashable] | ndarray
|
One label-free calibration anchor per source row. Anchors may be movie time-bin ids, stimulus ids, event ids, or other external alignment keys. They must not be held-out target class labels if the result is reported as Category 2. |
required |
target_calibration_features
|
Sequence[Sequence[float]] | ndarray
|
Held-out target-subject calibration rows used only for fitting the target projection. These rows should be disjoint from scored target test rows when the benchmark is not explicitly transductive. |
required |
target_calibration_anchor_values
|
Sequence[Hashable] | ndarray
|
Label-free target calibration anchors in the same anchor space as
|
required |
target_test_features
|
Sequence[Sequence[float]] | ndarray
|
Held-out target-subject rows to transform into the shared anchor space. |
required |
n_components
|
int | str | float
|
Maximum latent dimension. The effective dimension is capped by the number of common anchors minus one and the feature dimension. |
DEFAULT_UNLABELED_ANCHOR_COMPONENTS
|
regularization
|
float | str
|
Ridge regularization for each subject/domain projection. |
DEFAULT_UNLABELED_ANCHOR_REGULARIZATION
|
min_common_anchors
|
int | str
|
Minimum number of anchors that must be present in every source domain and in the target calibration set. |
2
|
Returns:
| Type | Description |
|---|---|
UnlabeledAnchorAlignmentResult
|
Source train rows and target test rows in a shared anchor-template space. |
Notes
This is a Category-2 protocol. It uses source features, source domain ids, source anchor values, target calibration features, and target calibration anchor values. It never accepts target class labels.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 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 190 191 192 | |
anchor_template(n_anchor_rows, *, n_components=DEFAULT_UNLABELED_ANCHOR_COMPONENTS, feature_dim=None)
Return a centered simplex template for shared unlabeled anchors.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
195 196 197 198 199 200 201 202 203 204 205 206 207 | |
fit_anchor_projection(anchor_features, template, *, domain_id='domain', regularization=DEFAULT_UNLABELED_ANCHOR_REGULARIZATION)
Fit a ridge projection from one domain's anchor rows to a template.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
transform_with_anchor_projection(features, projection)
Transform rows with a fitted anchor projection.
Source code in src/neureptrace/decoding/unlabeled_anchor_alignment.py
252 253 254 255 256 257 258 259 260 261 | |