AccumulatedLocalEffectsExplainer<T>

Models & Types · AiDotNet.Interpretability.Explainers

Model-agnostic Accumulated Local Effects (ALE) explainer.

Implements: IGlobalExplainer<T, ALEResult<T>>

For Beginners

ALE plots are an improved version of Partial Dependence Plots (PDP). They show how a feature affects predictions, but handle correlated features much better.

The key difference from PDP:

  • PDP: Averages over ALL data points (can create unrealistic combinations)
  • ALE: Only looks at ACTUAL data points in each interval (realistic combinations)

Example: If you have Age and Years of Experience (highly correlated), PDP might evaluate “Age=25 with 40 years experience” (impossible!). ALE avoids this by only looking at real data within each age range.

How ALE works:

  1. Divide the feature into intervals (bins)
  2. For each interval, compute the effect as the average difference in predictions

when moving from the left edge to the right edge of the interval

  1. Accumulate these effects to get the final ALE curve
  2. Center the curve so the average effect is zero

When to use ALE vs PDP:

  • Use ALE when features are correlated (most real-world cases)
  • Use PDP when features are independent

Constructors

Constructor Summary
AccumulatedLocalEffectsExplainer(Func<Matrix<T>, Vector<T>> predictFunction, Matrix<T> data, int numIntervals, string[] featureNames) Initializes a new Accumulated Local Effects explainer.

Properties

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

Methods

Method Summary
ALE2DResult<T> ComputeInteraction(int feature1Index, int feature2Index) Computes 2D ALE for feature interactions.
ALEResult<T> ComputeForFeature(int featureIndex) Computes ALE for a single feature.
ALEResult<T> ComputeForFeatures(int[] featureIndices) Computes ALE for multiple features.
ALEResult<T> ExplainGlobal(Matrix<T> data)