AdversarialDefenseOptions<T>

Options & Configuration · AiDotNet.Models.Options

Configuration options for adversarial defense mechanisms.

Inheritance: ModelOptions → AdversarialDefenseOptions<T>

For Beginners

These settings control how your “armor” protects the AI model. You can adjust how the defense is applied, how strong it should be, and what techniques to use.

How It Works

These options control adversarial training (Madry et al. 2018, “Towards Deep Learning Models Resistant to Adversarial Attacks”), the clean/adversarial mixing ratio of Goodfellow et al. 2015 (“Explaining and Harnessing Adversarial Examples”), input preprocessing defenses, and ensembles of independently trained defended models.

Constructors

Constructor Summary
AdversarialDefenseOptions()

Properties

Property Summary
AdversarialAttackMethod AttackMethod { get; set; } Gets or sets the attack that generates the adversarial training examples.
AdversarialPreprocessingMethod PreprocessingMethod { get; set; } Gets or sets the built-in preprocessing defense.
IAdversarialInputPreprocessor<T> CustomPreprocessor { get; set; } Gets or sets a custom preprocessing defense that replaces PreprocessingMethod.
bool UseEnsemble { get; set; } Gets or sets whether to train an ensemble of defended models and average their outputs.
bool UsePreprocessing { get; set; } Gets or sets whether to use input preprocessing for defense.
double AdversarialRatio { get; set; } Gets or sets the share of every training mini-batch that is replaced by adversarial examples.
double Epsilon { get; set; } Gets or sets the perturbation budget of the training attack.
double LearningRate { get; set; } Gets or sets the step size of the mini-batch gradient update of adversarial training.
int AttackIterations { get; set; } Gets or sets the number of iterations of the PGD training attack.
int BatchSize { get; set; } Gets or sets the mini-batch size of adversarial training.
int BitDepth { get; set; } Gets or sets the bit depth of BitDepthReduction.
int EnsembleSize { get; set; } Gets or sets the number of models in the ensemble.
int MedianFilterSize { get; set; } Gets or sets the window side of MedianSmoothing.
int TrainingEpochs { get; set; } Gets or sets the number of adversarial training epochs.