Source correlation filter
neureptrace.decoding.source_correlation_filter implements source-only correlation-based feature filtering.
The protocol is Category 1 / strict source-only. Feature correlations, feature importances, and the selected feature mask are estimated from source rows only. Evaluation rows are transformed with the fitted mask but are not used to fit it.
Typical usage:
from neureptrace.decoding.source_correlation_filter import fit_source_correlation_filter
result = fit_source_correlation_filter(
source_features=X_source,
test_features=X_target,
config={"max_abs_correlation": 0.98, "max_features": 256},
)
X_source_filtered = result.train_features
X_target_filtered = result.test_features
neureptrace.decoding.source_correlation_filter
Source-only correlation feature filtering.
This module fits a feature-redundancy mask from source rows only. Features are ranked by a source-only importance vector, then greedily kept when their absolute source correlation with previously kept features does not exceed the configured threshold. Evaluation rows are transformed with the fitted mask but never used to fit it.
SourceCorrelationFilterConfig
dataclass
Configuration for source-only correlation feature filtering.
Source code in src/neureptrace/decoding/source_correlation_filter.py
24 25 26 27 28 29 30 31 | |
SourceCorrelationFilterResult
dataclass
Filtered feature matrices and fitted source-only mask.
Source code in src/neureptrace/decoding/source_correlation_filter.py
34 35 36 37 38 39 40 41 42 43 | |
fit_source_correlation_filter(*, source_features, test_features, config=None)
Fit a source-only correlation mask and transform feature matrices.
Source code in src/neureptrace/decoding/source_correlation_filter.py
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 | |
source_correlation_filter_config(*, max_abs_correlation=DEFAULT_MAX_ABS_CORRELATION, max_features=None, min_features=1, epsilon=DEFAULT_EPSILON)
Normalize public source-correlation-filter options.
Source code in src/neureptrace/decoding/source_correlation_filter.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
source_feature_correlation(source_features, *, epsilon=DEFAULT_EPSILON)
Return the source-only feature correlation matrix.
Source code in src/neureptrace/decoding/source_correlation_filter.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
source_feature_importance(source_features, *, epsilon=DEFAULT_EPSILON)
Return source-only feature importance based on variance.
Source code in src/neureptrace/decoding/source_correlation_filter.py
136 137 138 139 140 141 | |
select_uncorrelated_features(correlation, *, importance=None, max_abs_correlation=DEFAULT_MAX_ABS_CORRELATION, max_features=None, min_features=1)
Greedily select low-redundancy feature indices.
Source code in src/neureptrace/decoding/source_correlation_filter.py
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 | |