Class TabularMixUp<T>
- Namespace
- AiDotNet.Augmentation.Tabular
- Assembly
- AiDotNet.dll
Applies MixUp augmentation to tabular data by linearly interpolating between samples.
public class TabularMixUp<T> : TabularMixingAugmenterBase<T>, ILabelMixingAugmentation<T, Matrix<T>>, IAugmentation<T, Matrix<T>>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, Matrix<T>>LabelMixingAugmentationBase<T, Matrix<T>>TabularMixUp<T>
- Implements
-
ILabelMixingAugmentation<T, Matrix<T>>IAugmentation<T, Matrix<T>>
- Inherited Members
Remarks
For Beginners: MixUp creates new training samples by blending two existing samples together. If you have sample A and sample B, MixUp creates a new sample that's (λ × A) + ((1-λ) × B), where λ is randomly chosen. The labels are blended the same way.
Benefits:
- Regularizes the model by creating "virtual" training examples
- Encourages smooth decision boundaries
- Reduces overconfidence in predictions
When to use:
- Classification tasks with numerical features
- When you want to reduce overfitting
- When decision boundaries should be smooth
Reference: Zhang et al., "mixup: Beyond Empirical Risk Minimization" (2017)
Constructors
TabularMixUp(double, double)
Creates a new MixUp augmentation for tabular data.
public TabularMixUp(double alpha = 0.2, double probability = 0.5)
Parameters
alphadoubleAlpha parameter for Beta distribution (default: 0.2). Smaller values keep samples closer to originals; larger values create more blending.
probabilitydoubleProbability of applying this augmentation (default: 0.5).
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
dataMatrix<T>The input data.
contextAugmentationContext<T>The augmentation context.
Returns
- Matrix<T>
The augmented data.
MixWithLabels(Matrix<T>, Matrix<T>, Vector<T>, Vector<T>, AugmentationContext<T>)
Applies MixUp to two data matrices and their labels, returning mixed results.
public (Matrix<T> Data, Vector<T> Labels, double Lambda) MixWithLabels(Matrix<T> data1, Matrix<T> data2, Vector<T> labels1, Vector<T> labels2, AugmentationContext<T> context)
Parameters
data1Matrix<T>The first data matrix.
data2Matrix<T>The second data matrix.
labels1Vector<T>Labels for the first data matrix.
labels2Vector<T>Labels for the second data matrix.
contextAugmentationContext<T>The augmentation context.