Error decomposition
A model with acceptable aggregate accuracy can fail in specific subpopulations. The error
decomposition splits a single aggregate number into per-cluster contributions so the
failure is visible. For classification the global AUC decomposes exactly into
intra-cluster and inter-cluster blocks:
AUCglobal=i=1∑Kj=1∑KwijAUCij
The diagonal terms measure discrimination within a cluster; the off-diagonal
terms measure how the model ranks one cluster's positives against another's negatives. A
low diagonal entry marks a subgroup the model cannot separate; a low off-diagonal entry
marks cross-subgroup miscalibration, a fairness concern the global AUC hides.
For regression the within-cluster MSE decomposes into four interpretable terms —
calibration, prediction variance, outcome variance and alignment:
MSEk=(fˉk−yˉk)2+σf,k2+σy,k2−2Covk(f,y)
This separates reducible error — poor calibration or misspent capacity — from the
irreducible outcome variance that no model can beat in that region. Summing over clusters
adds a between-cluster resolution block that measures how well the clustering separates
distinct outcome levels. Under binary outcomes with constant within-cluster predictions
this recovers Murphy's Brier decomposition exactly (reliability, resolution, uncertainty),
so the framework generalizes the classical result to continuous outcomes.
The clustering that drives the decomposition is itself error-aware. Error-Aware Random
Forest (EARF) clustering trains a random forest to predict residual magnitude from the
features and clusters samples by the forest's leaf co-occurrence, so samples are grouped
by shared error structure rather than feature similarity. The clusters can span
non-contiguous feature regions, precisely because error patterns cut across geometric
boundaries.
A dedicated User Guide page for the error decomposition is still to come. In the meantime
this note is the reference for the method.
Weakness detection and repair with FuseKernel
FuseKernel adds a way to find a model's weak regions and repair them. The detection step
uses the fused kernel as a learned geometry: diagnose_weak_clusters embeds
the fitted kernel with a Nyström spectral map, partitions the data into clusters in that
geometry and reports the model metric per cluster on train and test. Breaking performance
down per cluster surfaces the weak regions without having to guess where to look; the
result ranks the worst clusters and maps each test row to its cluster. Detection is cheap
— only the tree co-membership kernel at the base model's depth is needed, so the RBF and
spectral channels can stay off.
The repair step fits a residual-driven Mixture of Experts
(MoMoERegressor / MoMoEClassifier). With
cluster_method="ltc" it clusters samples by their learning trajectories —
where the base model struggles — fits a specialized expert per cluster and routes between
them with a gate. The experts can carry the same monotonicity constraints as the base
model, so the repaired model stays interpretable. The gain is largest where the base
model was weakest.
Weak-cluster detection and repair in the User Guide
→
Weakness diagnostics on the GBDT leaf kernel
The GBDT leaf kernel carries its own weakness diagnostic. diagnose_weakness
ranks the ensemble's behavioral clusters by their contribution to validation loss and,
for the weakest cluster, identifies the features that distinguish it from the rest by
Jensen–Shannon divergence between the in-cluster and out-of-cluster feature histograms.
The features with the largest divergence name the weak case — they describe the kind of
case the ensemble currently struggles with. This is residual weakness slicing anchored in
the model's own leaf kernel rather than in raw feature axes.
GBDT Leaf Kernel in the User Guide
→ AMIF weakness-region detection
TestSuite.diagnose_weakness_region locates weak regions of the input space
with an Adversarial Mutual Information Forest (AMIF) pipeline: geometry scoring via an
adversarial random forest, mutual-information scoring via a cross-validated random forest,
then 2D binning with a configurable grid and a weak-fraction cutoff. Features are ranked
by Jensen–Shannon divergence between the weak and non-weak regions. The outputs include
region-performance heatmaps for train and test, divergence and mutual-information
rankings, score distributions and per-feature distributions, and confusion matrices for
classification.
AMIF weakness region diagnostics in the User Guide
→