Milestone 3 of 8

Create a split from one permutation

Use one passed generator and one permutation to produce disjoint checking and working index arrays.

The split is a movement of positions, not a second meaning assigned to the records. Make the random step explicit and keep it small enough to inspect.

Goal

Use one passed NumPy generator to create one permutation of source positions, then divide that permutation into checking and working positions.

Inputs

The function should receive the source record count, a validated configuration, and one numpy.random.Generator created by the caller. A typical caller may create it with:

rng = np.random.default_rng(config.seed)

The split rule is exact: the first checking_count positions in the one permutation form the checking group; all remaining positions form the working group. Do not draw a separate random value for each column or group.

Deliverables

Implement a split function that returns named checking and working index arrays. The result should also make the source count and configuration visible to the caller. Do not change any source array while creating the indexes.

Checks

Use a small record count whose permutation can be inspected by hand. Check that both index arrays contain integers, that their combined length is the source count, that each source position appears once, and that the checking length is exactly checking_count.

Record a copy of the source count and configuration before the call and verify that they are unchanged afterwards. Pass a generator explicitly; the split function must not create a hidden generator from a global seed or use a global random state.

Run the same generator and configuration twice from the same initial state and compare the indexes. Record the generator implementation and runtime used for that replay. Do not claim that every future NumPy version will produce the same stream.

Workspace

Implement the movement rule in src/split.py. Keep the source arrays in src/aligned_data.py; src/main.py should pass only the information each stage needs.

Hints

HintPermute positions, not fields
A permutation of [0, 1, 2, 3] can select complete records. Four independent permutations can create four different tables.
HintUse the one generator you were given
The caller owns the generator state. Calling rng.permutation(record_count) once makes the source of the split visible.

Review

Explain why the first positions of the permutation, rather than the first rows of the source, form the checking group. Confirm that no claim about training, testing, or random sampling is being made here.

How to check your work

The supplied fixture uses one explicit generator and one permutation of positions. It records the implementation and runtime so an exact replay claim has a stated boundary.

LLM PrimerCreate a split from one permutationhttps://llmprimer.com/python/projects/build-a-reproducible-split-and-batch-pipeline/create-split-from-one-permutation© 2026 LLM Primer