kcode-speaker-dataset 0.2.0

Deterministic leakage-safe speaker dataset folds and repeatability groups
Documentation
# kcode-speaker-dataset

Deterministic leakage-safe speaker dataset views, open-set folds, and repeatability groups.

## API

- `build(active_rows: Vec<LabeledSample>, repeatability_rows: Vec<LabeledSample>) -> Result<Dataset, DatasetError>`
- `active_rows(dataset: &Dataset) -> &[LabeledSample]`
- `repeatability_rows(dataset: &Dataset) -> &[LabeledSample]`
- `open_set_folds(dataset: &Dataset, config: FoldConfig) -> Result<Vec<OpenSetFold>, DatasetError>`
- `repeatability_groups(dataset: &Dataset) -> Vec<RepeatabilityGroup>`

`Dataset` keeps both row views private and immutable. `build` validates them and sorts each canonically by sample ID, independent of caller order. Fold indices always address `active_rows`; repeatability-group indices always address `repeatability_rows`.

Dataset rows use the frozen 24-field feature schema from the exact-pinned `kcode-speaker-types` 0.2.0 package.

## Inputs and validation

Active data must be nonempty and belong to one cohort. Both views require valid segments, recording quality at most 100, and positive usable speech. Duplicate sample IDs within either view fail. A sample ID may occur in both views only when both rows are equal. Active `(clip_object, speaker_id)` observations must be unique, and an active clip cannot be assigned to multiple `group_id` values.

`group_id` is the supplied leakage boundary. Callers must place all known-related evidence in one group, including sibling or overlapping segments, every speaker in a clip, excerpts or duplicates, and recordings known to share a session. The library validates supplied relationships where possible but does not infer ancestry.

## Open-set folds

`FoldConfig { known_folds }` requires at least two folds. For every speaker and known-fold index, `open_set_folds` emits one fixture with that speaker completely withheld as `pseudo_unknown_speaker`. Every group containing that speaker is test-only: its rows for that speaker are unknown test, and co-speaker rows are known test. Remaining whole groups are assigned deterministically and approximately speaker-balanced among known folds. No group crosses train and test.

Every fixture requires nonempty train, known-test, and unknown-test sets, and every known-test speaker must also have training evidence. Unformable requests return a typed error rather than dropping rows or weakening grouping. Output and index ordering are deterministic and independent of input order.

## Repeatability

`repeatability_groups` returns canonical `(speaker_id, clip_object)` groups with at least two distinct attempts, sorted deterministically. Single attempts are omitted. Repeatability rows never become active training rows.

The library performs no I/O or persistence. Errors are reported as `DatasetError`.