Table of Contents

Class LabelMixingAugmentationBase<T, TData>

Namespace
AiDotNet.Augmentation
Assembly
AiDotNet.dll

Base class for label-mixing augmentations like Mixup and CutMix.

public abstract class LabelMixingAugmentationBase<T, TData> : AugmentationBase<T, TData>, ILabelMixingAugmentation<T, TData>, IAugmentation<T, TData>

Type Parameters

T

The numeric type for calculations.

TData

The data type being augmented.

Inheritance
LabelMixingAugmentationBase<T, TData>
Implements
IAugmentation<T, TData>
Derived
Inherited Members

Constructors

LabelMixingAugmentationBase(double, double)

Initializes a new label mixing augmentation.

protected LabelMixingAugmentationBase(double probability = 1, double alpha = 1)

Parameters

probability double

The probability of applying this augmentation.

alpha double

The alpha parameter for Beta distribution.

Properties

Alpha

Gets or sets the alpha parameter for Beta distribution sampling.

public double Alpha { get; set; }

Property Value

double

LastMixingLambda

Gets the mixing lambda from the last application.

public T LastMixingLambda { get; protected set; }

Property Value

T

Methods

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.

RaiseLabelMixing(LabelMixingEventArgs<T>)

Raises the label mixing event.

protected void RaiseLabelMixing(LabelMixingEventArgs<T> args)

Parameters

args LabelMixingEventArgs<T>

SampleLambda(AugmentationContext<T>)

Samples a mixing lambda value from Beta(alpha, alpha) distribution.

protected double SampleLambda(AugmentationContext<T> context)

Parameters

context AugmentationContext<T>

The augmentation context.

Returns

double

The sampled lambda value.

Events

OnLabelMixing

Event raised when labels need to be mixed.

public event EventHandler<LabelMixingEventArgs<T>>? OnLabelMixing

Event Type

EventHandler<LabelMixingEventArgs<T>>