Module Modelkit.Stratified_shuffle_split

Shuffled partitions with proportional class allocation; defaults to ten splits and a 10% test fraction. Requires aligned classification labels, at least two rows per class, and at least as many rows per partition as classes. Largest-remainder allocation fills training first, then test from remaining rows, with seeded tie breaking. Extreme imbalance can still omit a rare class from a partition. Classes follow first appearance order. Random streams are deterministic for the same input and seed, independent of execution scheduling; they do not reproduce NumPy random streams. Groups do not constrain these splits; use group-aware splitting when group exclusion is required.

type params = {
  1. splits : int;
  2. train_size : Split_size.t option;
  3. test_size : Split_size.t option;
}
type t
val create : ?splits:int -> ?train_size:Split_size.t -> ?test_size:Split_size.t -> unit -> (t, Error.t) result
include SPLITTER with type t := t and type params := params and type target = Target.classification Target.t and type rng = Rng.t
include SPECIFICATION with type t := t with type params := params
val clone : t -> t
val params : t -> params
type rng = Rng.t
val split : t -> rng:rng -> ?groups:Groups.t -> x:Matrix.t -> y:target option -> unit -> ((Row_view.t * Row_view.t) array, Error.t) result