Skip to content

train_test_split

Module: strata.model_selection • Kind: function
Source: strata/model_selection/split.mojo

def train_test_split[
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.float64,
](
dataset: Dataset[feat_dtype, target_dtype],
test_size: Float64 = 0.25,
shuffle: Bool = True,
seed: Int = 42,
) -> DatasetSplit[feat_dtype, target_dtype]
def train_test_split[dtype: DType = DType.float64](
X: Matrix[dtype],
y: List[Scalar[dtype]],
test_size: Float64 = 0.25,
shuffle: Bool = True,
seed: Int = 42,
) -> DatasetSplit[dtype, dtype]

Overload Note: This function provides multiple overloaded signatures.

from strata.model_selection import train_test_split

Split a Dataset container into random train and test partitions.

Returns: DatasetSplit[feat_dtype, target_dtype] — DatasetSplit: Container holding train and test Dataset partitions.