decompose_shap¶
Approximate-mode channel decomposition (approximate TRIAD, spec section 12).
Per-feature SHAP attributions phi from the deployed model are reallocated into I/D/M with the same routing as exact mode: the support weight uses the per-instance variance of phi across bag replicas instead of per-bin sampling variance. D is the residual phi - I - M, so C1 holds exactly.
ShapChannels
dataclass
¶
ShapChannels(
I: ndarray, D: ndarray, M: ndarray, w: ndarray
)
Dense (n_samples, n_features) channel matrices.
decompose_shap ¶
decompose_shap(
data: ShapData, tau2: ndarray
) -> ShapChannels
Reallocate deployed-model attributions into I/D/M channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ShapData
|
Approximate-mode contract (attributions, replica variance, masks). |
required |
tau2
|
ndarray
|
Per-feature signal variance, shape (n_features,), from
:func: |
required |
Source code in src/triadxai/decompose_shap.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |