CrossValidator and the proposed TrainValidatorSplit (
SPARK-8484) are Spark classes which partition data into training and evaluation sets for performing hyperparameter selection via cross validation.
Both methods currently perform the split by randomly sampling the datasets. However, when class probabilities are highly imbalanced (e.g. detection of extremely low-frequency events), random sampling may result in cross validation sets not representative of actual out-of-training performance (e.g. no positive training examples could be included).
Mainstream R packages like already caret support splitting the data based upon the class labels.