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
TThe numeric type for calculations.
TDataThe data type being augmented.
- Inheritance
-
AugmentationBase<T, TData>LabelMixingAugmentationBase<T, TData>
- Implements
-
ILabelMixingAugmentation<T, TData>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
probabilitydoubleThe probability of applying this augmentation.
alphadoubleThe alpha parameter for Beta distribution.
Properties
Alpha
Gets or sets the alpha parameter for Beta distribution sampling.
public double Alpha { get; set; }
Property Value
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
argsLabelMixingEventArgs<T>
SampleLambda(AugmentationContext<T>)
Samples a mixing lambda value from Beta(alpha, alpha) distribution.
protected double SampleLambda(AugmentationContext<T> context)
Parameters
contextAugmentationContext<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