PartialDependenceExplainer<T>
Models & Types · AiDotNet.Interpretability.Explainers
Model-agnostic Partial Dependence Plot (PDP) explainer with Individual Conditional Expectation (ICE) curves.
Implements: IGlobalExplainer<T, PartialDependenceResult<T>>
For Beginners
Partial Dependence Plots (PDPs) show how a feature affects predictions on average, while holding all other features constant.
Imagine you want to know “How does Age affect loan approval probability?”
- PDP: Shows the average effect of Age across all applicants
- ICE: Shows individual curves for each applicant (revealing if the effect varies)
Key insights:
- Upward slope = feature increases predictions
- Downward slope = feature decreases predictions
- Flat line = feature has little effect
- If ICE curves are parallel = consistent effect for everyone
- If ICE curves cross = the effect depends on other features (interaction)
PDPs are great for understanding global feature effects, but can be misleading when features are correlated. Use ALE (Accumulated Local Effects) for correlated features.
Constructors
| Constructor | Summary |
|---|---|
PartialDependenceExplainer(Func<Matrix<T>, Vector<T>> predictFunction, Matrix<T> backgroundData, int gridResolution, bool computeIce, string[] featureNames) |
Initializes a new Partial Dependence explainer. |
Properties
| Property | Summary |
|---|---|
bool SupportsGlobalExplanations { get; } |
|
bool SupportsLocalExplanations { get; } |
|
string MethodName { get; } |
Methods
| Method | Summary |
|---|---|
PartialDependence2DResult<T> ComputeInteraction(int feature1Index, int feature2Index) |
Computes 2D partial dependence for feature interactions. |
PartialDependenceResult<T> ComputeForFeature(int featureIndex) |
Computes partial dependence for a single feature. |
PartialDependenceResult<T> ComputeForFeatures(int[] featureIndices) |
Computes partial dependence for multiple features. |
PartialDependenceResult<T> ExplainGlobal(Matrix<T> data) |