package modelkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Modelkit.Train_test_split

Materialized train/test datasets with all row-aligned fields selected together, preserving feature schema and finiteness policy.

val split : ?train_size:Split_size.t -> ?test_size:Split_size.t -> ?shuffle:bool -> ?stratify:Target.classification Target.t -> rng:Rng.t -> 'kind Dataset.t -> unit -> ('kind Dataset.t * 'kind Dataset.t, Error.t) result

Defaults to shuffling and a 25% test fraction, like Holdout. Optional classification labels must match the source row count and require shuffle=true; stratification uses Stratified_shuffle_split's allocation rules. Dataset groups are copied, not kept exclusive. All fields follow the exact selected order; source data is immutable. Materialization can fail if a selected sample-weight partition has zero total weight. For row views instead of copies, use the splitter modules and Split.of_views.