<!--
{
  "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:seed:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML11MLDataTableV25stratifiedSplitBySequence11proportions2by2on4seedACSaySdG_S2SSitKF"
  },
  "title" : "stratifiedSplitBySequence(proportions:by:on:seed:)"
}
-->

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

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(proportions: [Double], by sequenceIdentifierColumn: String, on column: String, seed: Int = timestampSeed()) throws -> MLDataTable
```

## 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.

`seed`

Seed for the random number generator used for splitting. The default seed is the current epoch time in milliseconds.

## 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)