Milestone 5 of 8
Apply document groups through shared indexes
Select aligned arrays and metadata into supplied working, checking, and reserved groups while proving disjointness and complete coverage.
Groups are views over one complete example table. Build their indexes once and use the same indexes for every aligned field.
Goal
Apply the supplied document groups to examples without independent sorting, copying, or reordering of contexts, masks, targets, or metadata.
Inputs
Use the complete ordered table and the validated document_groups.csv. A
document belongs to exactly one configured group: working, checking, or
reserved. Every example inherits its document's group. The assignment is
supplied; do not infer or randomize it.
Deliverables
Implement group selection in src/groups.py. Create one shared integer index
array per group, then use it to select every aligned field. Save per-group
metadata and arrays, output/group_summary.csv, group order, and the source
assignment identity.
Checks
Validate that group assignments cover every input document once, name no unknown document, and use only configured names. Check that group example sets are disjoint and their union is the complete example set. Preserve the original order within each group.
Deliberately reorder target_ids or metadata independently and ensure the
alignment check fails. Follow one composite identity from the complete table
into its group arrays and confirm its context, mask, target, and metadata still
describe the same row. Check a group with no documents and a group with no
examples.
Workspace
Keep assignment validation in src/groups.py. Make one shared index the only
selection boundary for aligned arrays. Do not batch or shuffle groups here.
Hints
HintIndexes are the contract
HintEmpty is still a result
Review
Pick one row from each non-empty group and trace its document and target position back to the complete table. Explain why no row can appear in two groups.
How to check your work
Checks compare group order, counts, disjointness, and identity preservation with the supplied fixture. The supplied fixture does not call these operating labels train, validation, or test sets.