nirs4all.operators.transforms.sequence module
Fixed-width host encodings of variable-length multichannel series.
- class nirs4all.operators.transforms.sequence.SequenceSummary(statistics: Sequence[str] = ('mean', 'std', 'min', 'max'), *, include_length: bool = True, channel_names: Sequence[str] | None = None, min_observations: int = 1, channel_bounds: Sequence[Sequence[float]] | None = None)[source]
Bases:
TransformerMixin,BaseEstimatorSummarize each ragged series independently, without padding or resampling.
Input is a
nirs4all_io.ragged.RaggedSeriesBatch. Each row contains a variable number of observations and the same number of channels. Output columns are ordered by channel, then bystatistics; the optionallengthcolumn comes last. Standard deviation usesddof=0.Observations have equal weight: time coordinates are deliberately ignored. Empty series and nonfinite observed values are refused. Missing sources must be excluded by the source-presence policy before reaching this encoder. Fitting records the channel contract, not training values or lengths. New series lengths are therefore accepted by the fitted encoder.
- Parameters:
statistics – Ordered, distinct subset of
mean,std,minandmax. An empty sequence is permitted wheninclude_lengthis true, producing only the length column.include_length – Append the number of observations in each series.
channel_names – Optional distinct, nonempty names, one per channel. Otherwise use
channel_0,channel_1, etc. The source schema is responsible for preserving channel semantics across datasets.min_observations – Explicit minimum number of observations per series, checked during fit and prediction. The default accepts one.
channel_bounds – Optional inclusive, finite
(lower, upper)limits in channel order. Every observation must satisfy these declared limits. No applicability range is inferred from training or held-out rows.
- fit(X: Any, y: Any = None) Self[source]
Record a channel contract from the supplied training rows only.