Interpretation and visualization
Use this route for saliency or integrated-gradient maps, layer GradCAM, frequency-domain amplitude gradients, topomaps, confusion/metric plots, or model sanity checks.
Workflow
- Put the model in evaluation mode and confirm input shape
(batch, channels, time), target indices, device, and differentiability. Keep a cloned leaf tensor for attribution. - Use Captum wrappers for input-space methods and detach results before NumPy or plotting. Match target batch length and preserve channel/time axes.
- Use
amplitude_gradientsfor frequency analysis and interpret bins using the actual sampling rate and FFT convention. Validate with a tiny known filter before analyzing a large model. - For topomaps, require a montage or non-zero channel positions and a channel order matching the model input. Select a non-interactive plotting backend in headless jobs.
- Save figures and arrays to explicit writable paths; do not use visualization as evidence of causal importance without stability checks.
Read API reference, workflows, and troubleshooting. Run the local interpretation smoke to check gradient and frequency behavior without downloads or a display server. Captum is optional; install the visualization extra only for Captum methods.
