SmoteAugmenter<T>

Models & Types · AiDotNet.Augmentation.Tabular

Implements SMOTE (Synthetic Minority Over-sampling Technique) for imbalanced datasets.

Inheritance: AugmentationBase<T, Matrix<T>> → TabularAugmenterBase<T> → SmoteAugmenter<T>

For Beginners

SMOTE creates new synthetic samples for the minority class by interpolating between existing minority samples and their nearest neighbors. This helps balance imbalanced datasets where one class has far fewer samples than others.

How It Works

How it works:

  • For each minority sample, find its k nearest neighbors (also from minority class)
  • Randomly select one of these neighbors
  • Create a new sample along the line between the original and the neighbor

When to use:

  • Classification with severe class imbalance (e.g., fraud detection, rare disease)
  • When the minority class has too few samples to learn from
  • When undersampling the majority class would lose too much information

When NOT to use:

  • When classes are already balanced
  • For regression tasks (use other techniques)
  • When features are highly categorical (use SMOTE-NC instead)

Reference: Chawla et al., “SMOTE: Synthetic Minority Over-sampling Technique” (2002)

Constructors

Constructor Summary
SmoteAugmenter(int kNeighbors, double samplingRatio, double probability) Creates a new SMOTE augmenter.

Properties

Property Summary
double SamplingRatio { get; } Gets the sampling ratio for synthetic sample generation.
int KNeighbors { get; } Gets the number of nearest neighbors to consider.

Methods

Method Summary
IDictionary<string, object> GetParameters()
Matrix<T> GenerateSyntheticSamples(Matrix<T> minorityData, AugmentationContext<T> context) Applies SMOTE to generate synthetic samples for the minority class.
ValueTuple<Matrix<T>, Vector<T>> ApplySmoteWithLabels(Matrix<T> minorityData, Vector<T> minorityLabels, AugmentationContext<T> context) Applies SMOTE and returns combined original and synthetic data.