Table of Contents

Class RowShuffle<T>

Namespace
AiDotNet.Augmentation.Tabular
Assembly
AiDotNet.dll

Shuffles rows within a batch of tabular data.

public class RowShuffle<T> : TabularAugmenterBase<T>, IAugmentation<T, Matrix<T>>

Type Parameters

T

The numeric type for calculations.

Inheritance
AugmentationBase<T, Matrix<T>>
RowShuffle<T>
Implements
IAugmentation<T, Matrix<T>>
Inherited Members

Remarks

For Beginners: Row shuffling randomly reorders the samples in your data. While this doesn't create new data, it ensures the model doesn't learn from the order of samples, which is especially important when data has natural ordering.

When to use:

  • When data has natural temporal or sequential ordering
  • As part of mini-batch training to randomize batch composition
  • When consecutive samples might be correlated

Constructors

RowShuffle(double)

Creates a new row shuffle augmentation.

public RowShuffle(double probability = 1)

Parameters

probability double

Probability of applying this augmentation (default: 1.0).

Methods

ApplyAugmentation(Matrix<T>, AugmentationContext<T>)

Implement this method to perform the actual augmentation.

protected override Matrix<T> ApplyAugmentation(Matrix<T> data, AugmentationContext<T> context)

Parameters

data Matrix<T>

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

Matrix<T>

The augmented data.

ShuffleWithLabels(Matrix<T>, Vector<T>, AugmentationContext<T>)

Shuffles data and labels together, maintaining row correspondence.

public (Matrix<T> Data, Vector<T> Labels) ShuffleWithLabels(Matrix<T> data, Vector<T> labels, AugmentationContext<T> context)

Parameters

data Matrix<T>

The feature matrix.

labels Vector<T>

The label vector.

context AugmentationContext<T>

The augmentation context.

Returns

(Matrix<T> Data, Vector<T> Labels)

Tuple of (shuffled data, shuffled labels).