<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLDataTable/stratifiedSplitBySequence(proportions:by:on:generator:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML11MLDataTableV25stratifiedSplitBySequence11proportions2by2on9generatorACSaySdG_S2SxztKSGRzlF"
  },
  "title" : "stratifiedSplitBySequence(proportions:by:on:generator:)"
}
-->

# stratifiedSplitBySequence(proportions:by:on:generator:)

Randomly split a MLDataTable into partitions on a user-define label column, while keeping rows from the same sequence in the original order.

```
func stratifiedSplitBySequence<RNG>(proportions: [Double], by sequenceIdentifierColumn: String, on column: String, generator: inout RNG) throws -> MLDataTable where RNG : RandomNumberGenerator
```

## Parameters

`proportions`

An array of values on [0,1] specifying the proprtions in each partition. Automatically normalized to 1.

`sequenceIdentifierColumn`

The sequence identifier column in an MLDataTable to identify rows of a sequence.

`column`

The column in an MLDataTable being stratified on.

`generator`

User-defined RandomNumberGenerator to use in stratification.

## Return Value

A new MLDataTable with an additional partition column with the index of the partition for each row.

## Discussion

The proportions specified will be applied uniformly to each label being partitioned on.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)