Source bagging decoder
neureptrace.decoding.source_bagging implements a strict source-only bootstrap ensemble for feature decoding.
Each base estimator is trained on a source-only row sample and optional feature subset. Held-out rows are only scored, and probabilities are averaged across estimators.
This is Category 1 / strict source-only.
neureptrace.decoding.source_bagging
Strict source-only bootstrap bagging decoder.
This module provides a dependency-light Protocol-1 ensemble baseline for cross-subject feature decoding. Each base estimator is trained on a bootstrap or subsample of labeled source rows, optionally with a source-only feature subset. Held-out rows are scored by averaging estimator probabilities.
SourceBaggingConfig
dataclass
Configuration for the source-only bagging decoder.
Source code in src/neureptrace/decoding/source_bagging.py
29 30 31 32 33 34 35 36 37 38 39 40 | |
SourceBaggingResult
dataclass
Bagged predictions and provenance metadata.
Source code in src/neureptrace/decoding/source_bagging.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
n_estimators
property
Number of fitted base estimators.
fit_source_bagging_decoder(*, source_features, source_labels, test_features, estimator=None, config=None)
Fit a strict source-only bagged classifier and score held-out rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_features
|
Sequence[Sequence[float]] | ndarray
|
Labeled source rows used to fit all bootstrap estimators. |
required |
source_labels
|
Sequence[Sequence[float]] | ndarray
|
Labeled source rows used to fit all bootstrap estimators. |
required |
test_features
|
Sequence[Sequence[float]] | ndarray
|
Rows to score. These rows are never used for fitting. |
required |
estimator
|
BaseEstimator | None
|
Optional sklearn-compatible estimator. If omitted, a standardized balanced logistic-regression classifier is used. |
None
|
config
|
SourceBaggingConfig | Mapping[str, Any] | None
|
Bagging options. Mappings are normalized through
:func: |
None
|
Source code in src/neureptrace/decoding/source_bagging.py
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 | |
source_bagging_config(*, n_estimators=DEFAULT_N_ESTIMATORS, sample_fraction=DEFAULT_SAMPLE_FRACTION, feature_fraction=DEFAULT_FEATURE_FRACTION, bootstrap_rows=True, bootstrap_features=False, class_balanced=True, random_state=13, epsilon=DEFAULT_EPSILON)
Normalize public source-bagging options.
Source code in src/neureptrace/decoding/source_bagging.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |