4. Feature attribution techniques for engineering models
Engineering models rarely predict abstract labels. A surrogate for a turbine blade predicts peak stress in MPa; a thermal model predicts junction temperature in °C; a structural classifier predicts whether a weld will exceed its fatigue limit. When we attribute such a prediction to input features, the attribution must ultimately be expressed in the same physical units and design variables that the engineer controls — otherwise the explanation is technically correct but operationally useless.
This section covers three widely used attribution families — SHAP, LIME, and Integrated Gradients (IG) — and, more importantly, how to map their outputs back to physical quantities such as thickness, fillet radius, material yield strength, or inlet temperature.
What Each Method Actually Computes
SHAP assigns each feature a value equal to its average marginal contribution across all possible feature subsets, grounded in cooperative game theory. For a model f and input x, the Shapley value for feature i is:
φ_i = Σ_{S ⊆ F\{i}} [ |S|!(|F|-|S|-1)! / |F|! ] · ( f(S ∪ {i}) − f(S) )
In practice, exact computation is exponential, so implementations use KernelSHAP (model-agnostic, sampling-based) or TreeSHAP (exact for tree ensembles). The key property is local accuracy: the sum of all φ_i plus the base value equals the model output. This makes SHAP attractive for engineering because the attributions form a closed budget.
LIME fits a sparse linear surrogate around a single prediction by perturbing the input and weighting neighbors by proximity. The coefficients of that local linear model are the attributions. LIME is fast and model-agnostic but unstable: different random seeds can produce different explanations for the same point.
Integrated Gradients is gradient-based and requires a differentiable model. It integrates the gradient along a straight path from a baseline x' to the input x:
IG_i(x) = (x_i − x'_i) · ∫_0^1 ∂f(x' + α(x − x')) / ∂x_i dα
The choice of baseline is a modeling decision, not a technical detail. For a thermal model, a physically meaningful baseline might be the nominal operating point; for a stress model, it might be the minimum allowable wall thickness.
Mapping Attributions to Physical Units
The raw attribution from any of these methods carries the units of the output divided by the units of the input. If the model predicts stress in MPa and the input is wall thickness in mm, the SHAP value has units of MPa/mm. To make it interpretable, multiply by a realistic perturbation range:
Δσ_i ≈ φ_i · Δx_i
For example, if φ_thickness = −12 MPa/mm and the manufacturing tolerance is ±0.3 mm, the attributable stress swing is ∓3.6 MPa. This is the number a design engineer can act on. Reporting only the dimensionless SHAP value hides this.
For categorical or one-hot encoded design variables (e.g., material grade), the attribution is already in output units and represents the effect of switching from the reference category to the active one.
Worked Example: Surrogate for Weld Fatigue Life
Consider a gradient-boosted surrogate trained on 4,000 FEA simulations of a fillet weld. Inputs: leg size a (mm), toe radius r (mm), applied stress range Δσ (MPa), and yield strength σ_y (MPa). Output: predicted fatigue life N (cycles, log-transformed).
For a query point a=6.0, r=1.2, Δσ=180, σ_y=355, TreeSHAP returns the following attributions on the log-life scale:
| Feature | Value | SHAP (log₁₀ cycles) | Physical interpretation |
|---|---|---|---|
| Leg size a | 6.0 mm | +0.42 | Larger leg reduces stress concentration |
| Toe radius r | 1.2 mm | +0.31 | Blunter toe lowers K_t |
| Stress range Δσ | 180 MPa | −0.88 | Dominant driver; higher range shortens life |
| Yield strength σ_y | 355 MPa | +0.05 | Minor effect within this regime |
Base value = 5.10 log₁₀ cycles. Sum of attributions = −0.10, so predicted log-life = 5.00, i.e., 100,000 cycles. The engineer immediately sees that Δσ dominates and that increasing toe radius from 1.2 to 1.6 mm (a plausible process change) would add roughly 0.15 log₁₀ cycles — about a 40% life improvement — assuming the local gradient remains stable.
Choosing Between the Three Methods
Use TreeSHAP when the model is a tree ensemble and you need exact, consistent attributions with a closed budget. Use KernelSHAP when the model is a black box but you can afford thousands of evaluations. Use LIME for rapid sanity checks or when the model is highly non-differentiable and you only need local directionality. Use Integrated Gradients when the model is differentiable (neural network, Gaussian process with differentiable kernel) and you can justify a physically meaningful baseline.
A practical cross-check: compute SHAP and IG for the same point. If they disagree in sign for a feature, the model is likely non-monotonic in that region, and the explanation should be treated with caution.
Common Pitfalls in Engineering Attribution
- Correlated inputs. Thickness and leg size are often correlated in historical data. SHAP will split credit between them, understating each. Consider grouping correlated features or using conditional SHAP variants.
- Extrapolation. LIME and KernelSHAP perturb inputs without respecting physical bounds. A negative thickness perturbation is meaningless. Constrain the perturbation sampler to the feasible design space.
- Baseline selection for IG. A zero baseline is almost never physical. Use the nominal design, the lower tolerance bound, or the mean of the training set, and state which.
- Unit mismatch. Mixing normalized inputs (0–1) with physical outputs produces attributions that cannot be converted back without the normalization constants. Keep a record of scaler parameters.
Visual Summary
The diagram traces the full chain: design variables with tolerances enter the surrogate, the model produces a prediction, SHAP decomposes that prediction into per-feature contributions, and those contributions are converted into physical design insight. The critical step is the final one — without the unit conversion and tolerance context, the attribution remains a mathematical abstraction rather than an engineering decision aid.
Practical Checklist for Engineering Attribution
- Record the model type and whether exact or approximate attributions are used.
- Document the baseline or reference point for every attribution method.
- Convert attributions to physical units using the input scaler and a stated perturbation range.
- Check that the sum of attributions plus base value equals the model output (local accuracy).
- Cross-validate with a second method (e.g., SHAP vs. IG) and flag sign disagreements.
- Constrain perturbation sampling to the feasible design space for LIME and KernelSHAP.
- Validate the top-ranked feature against domain knowledge or a targeted FEA run.
When these steps are followed, feature attribution stops being a visualization exercise and becomes a quantitative bridge between the surrogate model and the physical design decisions it is meant to support.