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

# stratifiedSplit(proportions:on:seed:)

Randomly split a MLDataTable into a number partitions while stratifying on a user-define label column.

```
func stratifiedSplit(proportions: [Double], 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.

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