Class FeatureDropout<T>
- Namespace
- AiDotNet.Augmentation.Tabular
- Assembly
- AiDotNet.dll
Randomly masks (sets to zero) features in tabular data.
public class FeatureDropout<T> : TabularAugmenterBase<T>, IAugmentation<T, Matrix<T>>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, Matrix<T>>FeatureDropout<T>
- Implements
-
IAugmentation<T, Matrix<T>>
- Inherited Members
Remarks
For Beginners: Feature dropout randomly "hides" some features during training by setting them to zero. This forces the model to learn more robust representations that don't rely too heavily on any single feature.
When to use:
- To prevent overfitting to specific features
- To simulate missing data scenarios
- When you want the model to be robust to feature absence
When NOT to use:
- When all features are critical and cannot be missing
- When features have strong interdependencies that break when one is missing
Constructors
FeatureDropout(double, double, int[]?)
Creates a new feature dropout augmentation.
public FeatureDropout(double dropoutRate = 0.1, double probability = 0.5, int[]? featureIndices = null)
Parameters
dropoutRatedoubleProbability of dropping each feature (default: 0.1).
probabilitydoubleProbability of applying this augmentation (default: 0.5).
featureIndicesint[]Optional array of feature indices that can be dropped.
Properties
DropValue
Gets or sets the value to use for dropped features.
public double DropValue { get; set; }
Property Value
Remarks
Default: 0.0
Can be set to other values like -1 or the feature mean.
DropoutRate
Gets the probability of dropping each feature.
public double DropoutRate { get; }
Property Value
Remarks
Default: 0.1 (10% of features dropped)
Higher values drop more features. Typical range: 0.05 to 0.3
FeatureIndices
Gets or sets the indices of features that can be dropped.
public int[]? FeatureIndices { get; set; }
Property Value
- int[]
Remarks
If null, any feature can be dropped.
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.
GetParameters()
Gets the parameters of this augmentation.
public override IDictionary<string, object> GetParameters()
Returns
- IDictionary<string, object>
A dictionary of parameter names to values.