Class CertifiedDefenseOptions<T>
Configuration options for certified defense mechanisms.
public class CertifiedDefenseOptions<T>
Type Parameters
TThe numeric data type used for calculations (e.g., float, double).
- Inheritance
-
CertifiedDefenseOptions<T>
- Inherited Members
Remarks
These options control certified robustness methods that provide provable guarantees about model predictions under adversarial perturbations.
For Beginners: These settings control how the "guaranteed protection" works. You can adjust how many samples to use, how tight the guarantees should be, and what certification method to apply.
Properties
BatchSize
Gets or sets the batch size for certification.
public int BatchSize { get; set; }
Property Value
- int
The batch size, defaulting to 100.
Remarks
For Beginners: Processing multiple inputs at once speeds up certification. Larger batches are faster but use more memory.
CertificationMethod
Gets or sets the certification method to use.
public string CertificationMethod { get; set; }
Property Value
- string
The method name, defaulting to "RandomizedSmoothing".
Remarks
For Beginners: Different certification methods have different trade-offs: - RandomizedSmoothing: Works for any model, scalable - IBP (Interval Bound Propagation): Faster but might be looser - CROWN: Tight bounds but more computationally expensive
ConfidenceLevel
Gets or sets the confidence level for certification.
public double ConfidenceLevel { get; set; }
Property Value
- double
The confidence level (0-1), defaulting to 0.99.
Remarks
For Beginners: This is how confident you want to be in the guarantee. 0.99 means 99% confidence that the guarantee holds. Higher confidence requires more samples.
NoiseSigma
Gets or sets the noise standard deviation for randomized smoothing.
public double NoiseSigma { get; set; }
Property Value
- double
The noise sigma, defaulting to 0.25.
Remarks
For Beginners: This controls how much random noise is added. Larger sigma gives stronger robustness guarantees but might reduce accuracy.
NormType
Gets or sets the norm type for certification.
public string NormType { get; set; }
Property Value
- string
The norm type, defaulting to "L2".
Remarks
For Beginners: This defines what "small perturbation" means for certification. L2 norm is common for randomized smoothing.
NumSamples
Gets or sets the number of samples for randomized smoothing.
public int NumSamples { get; set; }
Property Value
- int
The number of samples, defaulting to 1000.
Remarks
For Beginners: Randomized smoothing makes predictions by averaging over many noisy versions of the input. More samples give tighter guarantees but take longer.
RandomSeed
Gets or sets the random seed for reproducible certification.
public int? RandomSeed { get; set; }
Property Value
- int?
The random seed, or null for non-deterministic random generation.
Remarks
When set to a specific value, the certification process produces reproducible results, which is useful for testing and debugging. When null, each certification run uses different random samples for proper statistical validity.
For Beginners: If you need reproducible results (e.g., for testing), set this to a specific number. For actual robustness certification, leave it as null so each run uses different random samples.
UseTightBounds
Gets or sets whether to use tight bounds computation.
public bool UseTightBounds { get; set; }
Property Value
- bool
True for tight bounds, false for faster looser bounds (default: false).
Remarks
For Beginners: Tight bounds give stronger guarantees but take longer to compute. Looser bounds are faster but might certify fewer examples.