Function Signature
Parameters
Feature array to split
Target array to split
Configuration options for the split
Returns
Description
Split arrays or matrices into random train and test subsets. This is a fundamental utility for model validation, allowing you to reserve a portion of your data for testing while training on the remainder. The function uses a seeded random number generator (Mulberry32) to ensure reproducible splits when the samerandomState is provided.
Example
Notes
- Both
Xandymust have the same length - At least 2 samples are required for splitting
- When
testSizeis a float (0 < testSize < 1), it represents the proportion of the dataset - When
testSizeis an integer, it represents the absolute number of test samples - Setting
shuffle=falsewith notestSizewill use the last 25% of samples for testing - The
randomStateparameter ensures reproducible results across multiple runs