Source-domain selection
neureptrace.decoding.source_selection provides a generic source-domain selection and weighting utility for cross-subject transfer experiments.
The protocol is Category 2 / unlabeled target-adaptive. It uses source features, source domain identifiers, optional source labels for class-balanced weighting, and unlabeled target features. It does not accept target labels.
neureptrace.decoding.source_selection
Source-domain selection and weighting for cross-subject transfer.
This module implements a generic Category-2 source-domain selection helper that can be used outside the MEKT-specific transfer path. Source subjects are scored by similarity to an unlabeled held-out target feature distribution, then converted into a selected-domain mask and optional sample weights. Target labels are not accepted by the public API.
SourceDomainSelectionResult
dataclass
Target-similarity source-domain selection result.
Source code in src/neureptrace/decoding/source_selection.py
28 29 30 31 32 33 34 35 36 37 | |
select_source_domains_by_target_similarity(source_features, source_domains, target_features, *, metric=DEFAULT_SOURCE_SELECTION_METRIC, top_k=None, max_distance=None, min_selected_domains=1, softmax_temperature=DEFAULT_SOURCE_SELECTION_TEMPERATURE, source_labels=None, class_balance=False)
Select or weight source domains by similarity to unlabeled target features.
Source code in src/neureptrace/decoding/source_selection.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 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 | |
selected_source_subset(source_features, source_labels, result)
Return selected source rows, labels, and normalized non-zero weights.
Source code in src/neureptrace/decoding/source_selection.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
normalize_source_selection_metric(metric)
Normalize public aliases for target-similarity metrics.
Source code in src/neureptrace/decoding/source_selection.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |