TreeSHAPExplanation<T>

Models & Types · AiDotNet.Interpretability.Explainers

Represents the result of a TreeSHAP analysis.

Implements: IFeatureAttribution<T>

Constructors

Constructor Summary
TreeSHAPExplanation()

Properties

Property Summary
T ExpectedValue { get; set; } Gets or sets the expected (baseline) prediction value.
T Prediction { get; set; } Gets or sets the actual prediction for this instance.
Vector<T> Instance { get; set; } Gets or sets the input instance.
Vector<T> ShapValues { get; set; } Gets or sets the SHAP values for each feature.
string[] FeatureNames { get; set; } Gets or sets the feature names.

Methods

Method Summary
List<ValueTuple<string, T, T>> GetNegativeContributions() Gets features that pushed the prediction lower.
List<ValueTuple<string, T, T>> GetPositiveContributions() Gets features that pushed the prediction higher.
List<ValueTuple<string, T, T>> GetSortedAttributions() Gets attributions sorted by absolute value (most important first).
T GetSumError() Verifies that SHAP values sum to (prediction - expected_value).
Vector<T> GetFeatureAttributions()
string ToString() Returns a human-readable summary.