StratifiedTrainValTestSplitter<T>

Models & Types ยท AiDotNet.Preprocessing.DataPreparation.Splitting.Stratified

Stratified three-way split that preserves class distribution in all sets.

Inheritance: DataSplitterBase<T> โ†’ StratifiedTrainValTestSplitter<T>

For Beginners

This creates train/validation/test splits while ensuring each set has the same class proportions as the original data.

How It Works

Example: If original data has 60% Class A, 30% Class B, 10% Class C:

  • Training set: ~60% A, ~30% B, ~10% C
  • Validation set: ~60% A, ~30% B, ~10% C
  • Test set: ~60% A, ~30% B, ~10% C

Constructors

Constructor Summary
StratifiedTrainValTestSplitter(double trainSize, double validationSize, bool shuffle, int randomSeed) Creates a new stratified three-way splitter.

Properties

Property Summary
bool RequiresLabels { get; }
bool SupportsValidation { get; }
string Description { get; }

Methods

Method Summary
DataSplitResult<T> Split(Matrix<T> X, Vector<T> y)