FeatureAblationExplainer<T>
Models & Types · AiDotNet.Interpretability.Explainers
Feature Ablation explainer for understanding feature importance by removal.
Implements: IGPUAcceleratedExplainer<T>, IGlobalAttributionExplainer<T>, IGlobalExplainer<T, GlobalFeatureAblationResult<T>>, ILocalExplainer<T, FeatureAblationExplanation<T>>
For Beginners
Feature Ablation is a simple way to understand feature importance. The idea is: replace each feature with a “baseline” value and see how the prediction changes.
How it works:
- For each feature (or group of features):
- Replace the feature with a baseline (e.g., zero, mean, or reference value)
- Measure how much the prediction changes
- Features that cause large changes are important
Difference from Occlusion:
- Occlusion: Slides a window over spatial data (images)
- Feature Ablation: Works on individual features (tabular data, any modality)
Key advantage: You can group features and ablate them together:
- All color channels for an image
- All words in a sentence segment
- All related features in tabular data
Use cases:
- Understanding which features drive predictions in tabular data
- Grouping related features (e.g., all “income” related columns)
- Debugging models by finding unexpected important features
Constructors
| Constructor | Summary |
|---|---|
FeatureAblationExplainer(Func<Tensor<T>, Tensor<T>> tensorPredictFunction, int[][] featureGroups, string[] featureNames, bool perturbEachSeparately) |
Initializes a Feature Ablation explainer for tensor inputs. |
FeatureAblationExplainer(Func<Vector<T>, Vector<T>> predictFunction, Vector<T> baseline, int[][] featureGroups, string[] featureNames, bool perturbEachSeparately) |
Initializes a new Feature Ablation explainer. |
Properties
| Property | Summary |
|---|---|
bool IsGPUAccelerated { get; } |
|
bool SupportsGlobalExplanations { get; } |
Gets whether this explainer supports global explanations. |
bool SupportsLocalExplanations { get; } |
Gets whether this explainer supports local explanations. |
string MethodName { get; } |
Gets the method name. |
Methods
| Method | Summary |
|---|---|
FeatureAblationExplanation<T> Explain(Vector<T> instance) |
Explains a single input (ILocalExplainer interface). |
FeatureAblationExplanation<T> ExplainLocal(Vector<T> input, int? targetClass) |
Explains a single input by ablating features. |
FeatureAblationExplanation<T>[] ExplainBatch(Matrix<T> instances) |
|
GlobalFeatureAblationResult<T> ExplainGlobal(Matrix<T> data) |
Computes global feature importance across a dataset. |
GlobalFeatureAblationResult<T> ExplainGlobal(Matrix<T> data, int? targetClass) |
Computes global feature importance across a dataset for a specific class. |
Vector<T> ComputeGlobalAttributions(Matrix<T> data) |
Explains a batch of inputs (ILocalExplainer interface). |
void SetGPUHelper(GPUExplainerHelper<T> helper) |