01 / Reproduce
Inspect the ticket split
Download and extract the practice ZIP into a fresh folder. It includes check-split.py, tickets.csv, pinned requirements and a README. With Python 3.11 or newer and compatible package wheels, open PowerShell in that folder:
python --version
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe .\check-split.py
Get-Content -LiteralPath .\lab-output\report.json
The CSV has five tickets for ACCT-A, four for ACCT-B, two for ACCT-C and one for ACCT-D. Each has a unique ticket ID, an account ID, an authored billing/access topic and fictional text. The script compares a shuffled row split with a grouped account split using random_state=42. Our observed output:
Python 3.13.15 / scikit-learn 1.9.1 / no model trained
row_split: train=9, test=3, shared_accounts=["ACCT-A"]
group_split: train=8, test=4, shared_accounts=[]
Grouped test accounts: ACCT-B
Report: lab-output\report.json
In the row split, T-101 is in test while T-102 through T-105 are in train. These are different tickets from ACCT-A. If practice examples expose account-specific language, the later score could mix familiarity with that account and ability to handle unseen accounts. This lab demonstrates the overlap; it does not measure its effect on a score.
Open row-train.csv and row-test.csv beside group-train.csv and group-test.csv. The report records every ticket ID, account set, topic count, input SHA256 and package version. Existing output directories are refused, and the source CSV is read only.
02 / Inspect
Hold out an account
train_test_split splits samples. In this example a sample is one ticket row. GroupShuffleSplit uses the supplied account labels to keep a group together within a split. It does not discover which accounts belong together.
Save this shorter excerpt as inspect-split.py beside the CSV, then run .\.venv\Scripts\python.exe .\inspect-split.py:
import csv
from sklearn.model_selection import GroupShuffleSplit
with open("tickets.csv", newline="", encoding="utf-8") as handle:
rows = list(csv.DictReader(handle))
groups = [row["account_id"] for row in rows]
splitter = GroupShuffleSplit(
n_splits=1, test_size=0.25, random_state=42
)
train, test = next(splitter.split(rows, groups=groups))
train_accounts = {groups[i] for i in train}
test_accounts = {groups[i] for i in test}
if train_accounts & test_accounts:
raise ValueError("An account appears on both sides")
print(sorted(test_accounts))
print(len(train), len(test))
It prints ['ACCT-B'], then 8 4. The group labels stay aligned with the CSV rows. The full script also checks that every row appears exactly once across train and test, and rejects duplicate ticket IDs or blank fields before writing files.
test_size=0.25 selects one of four distinct accounts. ACCT-B has four tickets, so the grouped test set contains four of twelve rows. Group fractions refer to groups; they do not promise the same fraction of rows.The reason to choose this split is the intended question. The scikit-learn guide to grouped data explains evaluating on groups absent from training. For an AI prompt workflow, we can apply the same boundary to the examples used during prompt development: keep the chosen test accounts out of example selection and revisions. That application is a proposed workflow, not an experiment we ran with a model.
03 / Make it your own
Change the fraction, then choose your boundary
Try the tested adaptation with a fresh output directory:
.\.venv\Scripts\python.exe .\check-split.py --test-fraction 0.5 --out adapted-output
Our grouped run held out ACCT-B and ACCT-D: two of four accounts, containing five of twelve tickets. It shared no accounts. The corresponding row split used six test tickets and shared ACCT-A and ACCT-B. Inspect the report's topic counts too; this splitter does not balance billing and access labels for you.
To adapt it, first write down what “new” means in your project. A new ticket from a known customer is a different deployment question from a new customer. For document classification, the group might be a source document family. For conversation evaluation, it might be an entire thread. Use fictional examples shaped like your data, replace the grouping column deliberately, and inspect both sets before adding a model.
Grouping by account alone can miss related parent organizations or copied templates across accounts. Future-facing work may also need a chronological boundary. A seed makes this exercise reproducible; it does not make the chosen partition representative. Decide the evaluation design before comparing scores, and keep a final holdout out of prompt or model selection.
04 / Boundaries
Keep the evidence in scope
We ran both split fractions, the exact excerpt above, row coverage and account-overlap checks, input-hash preservation, malformed-input refusals and refusal to overwrite existing results. We reran the exercise from extracted local and public practice ZIPs. This verifies partition behavior for an authored fixture.
No model was trained or queried. We measured no accuracy, score inflation, performance or production behavior. The account IDs and topic labels were authored; their real-world correctness was not evaluated. Zero account overlap does not prove that all information leakage is absent.
This is one holdout per run, not a complete cross-validation study. Multiple randomized grouped splits can reuse test groups across runs. If you later add learned preprocessing, fit it using training data only; see the official data-leakage guidance. Repeatedly revising a prompt against the same test examples also changes how that set is being used.
Optional AI review prompt, not run: “Review this fictional evaluation plan. Our target is unseen customer accounts. Identify which examples or preprocessing steps could expose a held-out account during development. Propose checks and list what you cannot verify from this plan.”
05 / Primary sources
Read the primary sources
- GroupShuffleSplit API — group-based sizes, supplied labels, random state and repeated-split limits.
- train_test_split API — row-level splitting behavior.
- Grouped-data evaluation guide — why unseen groups require a suitable split.
- Common pitfalls: data leakage — separate training and testing before learning transformations.
Primary sources checked November 25, 2026. Locally tested with scikit-learn 1.9.1 and the pinned dependencies in the kit. This is a practical use of an established tool, not a new-release announcement.
06 / Keep it handy
Get the practice and posting files
The practice ZIP contains the script, fictional CSV, requirements and README. The posting ZIP contains the original portrait, starter teaser, alt text and full article URL. Social content is prepared for manual posting; it has not been scheduled or published.
Browse more AI Anonymous field notes or talk with JABSystems about your workflow.

