DeepLIFTExplainer<T>

Models & Types · AiDotNet.Interpretability.Explainers

DeepLIFT (Deep Learning Important FeaTures) explainer for neural networks.

Implements: IGPUAcceleratedExplainer<T>, IGlobalAttributionExplainer<T>, ILocalExplainer<T, DeepLIFTExplanation<T>>

For Beginners

DeepLIFT is a method for explaining neural network predictions by comparing activations to a reference/baseline.

How it differs from gradients:

  • Gradients: “How would the output change if I slightly changed the input?”
  • DeepLIFT: “How much does each input contribute compared to a baseline?”

Key concepts:

  1. Reference/Baseline: A neutral input (like zeros or average input)
  2. Difference from reference: Compares actual activations to reference activations
  3. Multipliers: How much each neuron’s difference-from-reference contributes

DeepLIFT variants:

  • Rescale: Distributes contribution proportionally
  • RevealCancel: Handles positive and negative contributions separately

Advantages over gradients:

  • More stable than gradients (no saturation issues)
  • Handles non-linearities better (ReLU, etc.)
  • Contributions sum to the difference between output and baseline output

Example: For a spam classifier:

  • Reference: Average email or neutral text
  • DeepLIFT shows which words made the email MORE or LESS likely to be spam

compared to the reference

Constructors

Constructor Summary
DeepLIFTExplainer(Func<Vector<T>, Vector<T>> predictFunction, Func<Vector<T>, Vector<T>> getActivations, Func<Vector<T>, Vector<T>, Vector<T>> computeMultipliers, int numFeatures, Vector<T> baseline, string[] featureNames, DeepLIFTRule rule) Initializes a new DeepLIFT explainer.
DeepLIFTExplainer(INeuralNetwork<T> neuralNetwork, int numFeatures, Vector<T> baseline, string[] featureNames, DeepLIFTRule rule) Initializes a new DeepLIFT explainer from a neural network model.

Properties

Property Summary
bool IsGPUAccelerated { get; }
bool SupportsGlobalExplanations { get; }
bool SupportsLocalExplanations { get; }
string MethodName { get; }

Methods

Method Summary
DeepLIFTExplanation<T> Explain(Vector<T> instance) Computes DeepLIFT attributions for an input.
DeepLIFTExplanation<T> Explain(Vector<T> instance, int outputIndex) Computes DeepLIFT attributions for a specific output.
DeepLIFTExplanation<T>[] ExplainBatch(Matrix<T> instances)
Vector<T> ComputeGlobalAttributions(Matrix<T> data)
void SetGPUHelper(GPUExplainerHelper<T> helper)