RandomizedSmoothing<T, TInput, TOutput>
Models & Types · AiDotNet.AdversarialRobustness.CertifiedRobustness
Implements Randomized Smoothing for certified robustness.
Implements: ICertifiedDefense<T, TInput, TOutput>
For Beginners
Randomized Smoothing is like asking multiple slightly different versions of a question and taking the majority vote. By adding random noise to the input many times and seeing what the model predicts each time, we can mathematically prove that the prediction is robust to small changes.
How It Works
Randomized Smoothing creates a smoothed classifier by averaging predictions over Gaussian noise, enabling provable robustness guarantees.
Original paper: “Certified Adversarial Robustness via Randomized Smoothing” by Cohen et al. (2019)
Constructors
| Constructor | Summary |
|---|---|
RandomizedSmoothing(CertifiedDefenseOptions<T> options) |
Initializes a new instance of Randomized Smoothing. |
Methods
| Method | Summary |
|---|---|
CertifiedAccuracyMetrics<T> EvaluateCertifiedAccuracy(TInput[] testData, TOutput[] labels, IFullModel<T, TInput, TOutput> model, T radius) |
|
CertifiedDefenseOptions<T> GetOptions() |
|
CertifiedPrediction<T> CertifyPrediction(TInput input, IFullModel<T, TInput, TOutput> model) |
|
CertifiedPrediction<T>[] CertifyBatch(TInput[] inputs, IFullModel<T, TInput, TOutput> model) |
|
T ComputeCertifiedRadius(TInput input, IFullModel<T, TInput, TOutput> model) |
|
byte[] Serialize() |
|
int? PredictWithAbstention(TInput input, IFullModel<T, TInput, TOutput> model) |
PREDICT of Cohen et al. |
void Deserialize(byte[] data) |
|
void LoadModel(string filePath) |
|
void Reset() |
|
void SaveModel(string filePath) |