Shape · Rows

Random Split

Divides rows into named groups by percentage, each on its own output, such as 80/20 train and test. Repeatable, and can keep each group's share of a column.

Also known as: Train/test split, A/B cohorts, create samples

How it works

Groups lists the parts, each with a name and a whole-number percentage; a fresh node has train 80 and test 20, Add group adds more, and the percentages must sum to 100 before the node runs. Each group is its own output port, every row lands in exactly one group, and each group gets its percentage to within one row. Seed (42 by default) makes the split repeatable: the same seed over the same rows gives the same split, but rows are told apart by all their values, so changing a column upstream re-draws it. Stratify by (optional) splits each value of a column on its own.

Inputs and outputs

Inputs

  • data — Table

Outputs

  • group_1 — Table

Settings

The Attributes panel of Random Split, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
{
  groups: [{ id: "group_1", name: string, percent: number }]
  seed: number
  stratifyBy?: string
}

— 2+ groups, whole-number percents summing to 100; each group is an output port

Example

An A/B/holdout cohort of customers: Groups A 45, B 45, holdout 10, Stratify by country so every group has the same country mix. Wire the three ports to three different downstream branches.