nirs4all.pipeline.analysis.splitter_config module
Splitter (CV) configuration extraction from stored pipeline configs.
Answers “which cross-validation setup did this pipeline use?” from the
expanded_config JSON the workspace store persists per pipeline — the
canonical step list written by WorkspaceStore.begin_pipeline().
This inference previously lived in the nirs4all-studio HTTP layer (BV-07 in its 2026-06-05 tech-debt closeout): the studio hand-parsed the library’s own storage format and hand-listed splitter names. The parsing of library-written data belongs to the library; UIs keep only their display vocabulary.
Recognition order: nirs4all’s own splitter registry, sklearn
model_selection splitters (by module path or class name), then a token
fallback (split/fold/loo/holdout) for custom classes.
- class nirs4all.pipeline.analysis.splitter_config.SplitterConfig(splitter_class: str, reference: str, n_splits: int | None = None, shuffle: bool | None = None, random_state: int | None = None, test_size: float | None = None, group_by: str | None = None)[source]
Bases:
objectCanonical CV-splitter configuration recovered from a stored pipeline.
- Variables:
splitter_class (str) – Leaf class name (e.g.
"KFold").reference (str) – The raw step reference as stored.
n_splits (int | None) – Fold count when the splitter declares one.
shuffle (bool | None) – Shuffle flag when declared.
random_state (int | None) – Seed when declared.
test_size (float | None) – Test fraction when declared (shuffle/holdout splitters).
group_by (str | None) – Grouping column when declared (group-aware splitters).
- nirs4all.pipeline.analysis.splitter_config.extract_splitter_config(expanded_config: Any) SplitterConfig | None[source]
Recover the CV-splitter configuration from a stored pipeline config.
Scans the canonical step list for the first splitter step and returns its class plus canonical parameters. Returns
Nonewhen the pipeline has no recognizable splitter (e.g. predict-only chains).
- nirs4all.pipeline.analysis.splitter_config.is_splitter_reference(reference: str) bool[source]
Whether a step reference denotes a CV/data splitter.
Checks nirs4all’s splitter registry, the sklearn
model_selectionsplitter set (by class name or module path), then falls back to name tokens for custom splitters.
- nirs4all.pipeline.analysis.splitter_config.parse_expanded_config_steps(expanded_config: Any) list[Any][source]
Return the canonical step list from a stored
expanded_config.Accepts the raw column value (JSON string, dict with a
pipelinekey, or already-parsed list) and normalizes to a list of steps.