Table of Contents

Class AugmentationConfig

Namespace
AiDotNet.Augmentation
Assembly
AiDotNet.dll

Unified configuration for data augmentation with industry-standard defaults.

public class AugmentationConfig
Inheritance
AugmentationConfig
Inherited Members

Remarks

For Beginners: Data augmentation creates variations of your training data (like flipping images, adding noise, or shuffling words) to help your model learn better and become more robust. This configuration controls how augmentation works.

Key features:

  • Automatic data-type detection (image, tabular, audio, text, video)
  • Industry-standard defaults that work well out-of-the-box
  • Test-Time Augmentation (TTA) enabled by default for better predictions
  • Modality-specific settings for fine-tuning

Example - Simple usage with defaults:

var result = builder
    .ConfigureModel(myModel)
    .ConfigureAugmentation()  // Uses auto-detected defaults
    .Build(X, y);

Example - Custom configuration:

var config = new AugmentationConfig
{
    EnableTTA = true,
    TTANumAugmentations = 8,
    ImageSettings = new ImageAugmentationSettings
    {
        EnableFlips = true,
        EnableRotation = true,
        RotationRange = 20.0
    }
};
builder.ConfigureAugmentation(config);

Constructors

AugmentationConfig()

Creates a new augmentation configuration with industry-standard defaults.

public AugmentationConfig()

Properties

AudioSettings

Gets or sets audio-specific augmentation settings.

public AudioAugmentationSettings? AudioSettings { get; set; }

Property Value

AudioAugmentationSettings

Remarks

If null, auto-configured with industry-standard defaults when audio data is detected.

EnableTTA

Gets or sets whether Test-Time Augmentation is enabled during inference.

public bool EnableTTA { get; set; }

Property Value

bool

Remarks

Default: true (recommended for production)

For Beginners: TTA improves prediction accuracy by making multiple predictions on augmented versions of your input and combining them. This typically improves accuracy by 1-3% at the cost of slower inference.

ImageSettings

Gets or sets image-specific augmentation settings.

public ImageAugmentationSettings? ImageSettings { get; set; }

Property Value

ImageAugmentationSettings

Remarks

If null, auto-configured with industry-standard defaults when image data is detected.

IsEnabled

Gets or sets whether augmentation is enabled.

public bool IsEnabled { get; set; }

Property Value

bool

Remarks

Default: true

Set to false to disable augmentation entirely without removing configuration.

Probability

Gets or sets the global probability of applying any augmentation.

public double Probability { get; set; }

Property Value

double

Remarks

Default: 0.5 (50% chance)

For Beginners: This controls how often augmentations are applied. At 0.5, each augmentation has a 50% chance of being applied to each sample. Higher values (0.8) mean more aggressive augmentation.

Seed

Gets or sets the random seed for reproducible augmentations.

public int? Seed { get; set; }

Property Value

int?

Remarks

Default: null (random each time)

Set a specific seed for reproducible results (useful for debugging).

TTAAggregation

Gets or sets how to aggregate TTA predictions.

public PredictionAggregationMethod TTAAggregation { get; set; }

Property Value

PredictionAggregationMethod

Remarks

Default: Mean

Options: Mean (average), Median (robust to outliers), Vote (for classification), Max, Min, WeightedMean, GeometricMean.

TTAIncludeOriginal

Gets or sets whether to include the original (non-augmented) sample in TTA.

public bool TTAIncludeOriginal { get; set; }

Property Value

bool

Remarks

Default: true

Almost always leave this enabled to include the "ground truth" view.

TTANumAugmentations

Gets or sets the number of augmented samples for TTA.

public int TTANumAugmentations { get; set; }

Property Value

int

Remarks

Default: 5 (research-backed optimal count)

For Beginners: More augmentations = more accurate but slower. Research shows diminishing returns beyond 10.

TabularSettings

Gets or sets tabular-specific augmentation settings.

public TabularAugmentationSettings? TabularSettings { get; set; }

Property Value

TabularAugmentationSettings

Remarks

If null, auto-configured with industry-standard defaults when tabular data is detected.

TextSettings

Gets or sets text-specific augmentation settings.

public TextAugmentationSettings? TextSettings { get; set; }

Property Value

TextAugmentationSettings

Remarks

If null, auto-configured with industry-standard defaults when text data is detected.

VideoSettings

Gets or sets video-specific augmentation settings.

public VideoAugmentationSettings? VideoSettings { get; set; }

Property Value

VideoAugmentationSettings

Remarks

If null, auto-configured with industry-standard defaults when video data is detected.

Methods

ForAudio()

Creates an augmentation configuration for audio data with standard defaults.

public static AugmentationConfig ForAudio()

Returns

AugmentationConfig

A configuration optimized for audio augmentation.

ForImages()

Creates an augmentation configuration for image data with standard defaults.

public static AugmentationConfig ForImages()

Returns

AugmentationConfig

A configuration optimized for image augmentation.

ForTabular()

Creates an augmentation configuration for tabular data with standard defaults.

public static AugmentationConfig ForTabular()

Returns

AugmentationConfig

A configuration optimized for tabular augmentation.

ForText()

Creates an augmentation configuration for text data with standard defaults.

public static AugmentationConfig ForText()

Returns

AugmentationConfig

A configuration optimized for text augmentation.

ForVideo()

Creates an augmentation configuration for video data with standard defaults.

public static AugmentationConfig ForVideo()

Returns

AugmentationConfig

A configuration optimized for video augmentation.

GetConfiguration()

Gets the configuration as a dictionary for logging or serialization.

public IDictionary<string, object> GetConfiguration()

Returns

IDictionary<string, object>

A dictionary containing all configuration values.