NoiseTunnelExplainer<T, TExplanation>
Models & Types · AiDotNet.Interpretability.Explainers
Noise Tunnel wrapper that smooths attributions by averaging over noisy inputs.
For Beginners
Gradient-based attribution methods can produce noisy results because gradients are sensitive to small input perturbations. NoiseTunnel addresses this by averaging attributions computed on multiple noisy versions of the input.
How it works:
- Take the original input
- Create multiple copies with small random noise added
- Compute attributions for each noisy copy
- Average (or aggregate) the attributions
Aggregation methods:
- SmoothGrad: Simple average of attributions (most common)
- SmoothGrad-Squared: Average of squared attributions (emphasizes important features)
- VarGrad: Variance of attributions (shows where gradients vary most)
Benefits:
- Reduces noise in attribution maps
- Makes explanations more visually interpretable
- More stable under small input changes
Parameters:
- NumSamples: More samples = smoother results (default: 5-10)
- StdDev: Standard deviation of noise (typical: 0.1-0.3 of input range)
Reference: Smilkov et al., “SmoothGrad: removing noise by adding noise” (2017)
Constructors
| Constructor | Summary |
|---|---|
NoiseTunnelExplainer(ILocalExplainer<T, TExplanation> baseExplainer, Func<TExplanation, Vector<T>> attributionExtractor, Func<Vector<T>, TExplanation, TExplanation> attributionReplacer, NoiseTunnelType noiseTunnelType, int numSamples, double stdDev, int? seed) |
Initializes a NoiseTunnel wrapper around a base explainer. |
Properties
| Property | Summary |
|---|---|
string MethodName { get; } |
Gets the name of this method. |
Methods
| Method | Summary |
|---|---|
TExplanation Explain(Vector<T> input) |
Explains an input with noise-smoothed attributions. |
TExplanation[] ExplainBatch(Matrix<T> inputs) |
Explains multiple inputs with noise-smoothed attributions. |