Release notes

MoDeVa 2.0 — What's New

July 2026

MoDeVa is a single toolkit for the interpretable model lifecycle: data management, exploratory analysis, feature engineering, model training, interpretation and validation across accuracy, reliability, robustness and fairness. Version 2.0 keeps that surface unchanged and extends it in three directions — four model families that read a fitted tree ensemble as a geometric or kernel object, validation diagnostics that turn a single aggregate error number into a map of where and why a model fails, and a change in how the package is distributed and licensed.

Every 1.x workflow — the DataSet, ModelZoo, TestSuite, Experiment and Pipeline APIs, and the existing model wrappers — runs without modification. The new material is additive.

Before you install

  • NumPy 1.x only. MoDeVa requires numpy>=1.21.4,<=1.26.4, so it will not install into an environment with NumPy 2.x — pip refuses the resolution rather than failing later at import. This bound is declared by every 2.x wheel, not just 2.0, and still applies on the current release.
  • Python 3.12 only. Wheels are published for CPython 3.12 on Linux (x86_64, aarch64), macOS and Windows.

Install into a fresh environment:

pip install modeva

New models

The four new model families share one premise. A fitted gradient-boosted ensemble is not only a predictor but a learned geometry: the leaves it routes a sample to encode how the model partitions feature space. DirectRS reshapes that geometry into a linear post-processor, the GBDT leaf kernel re-reads it as a kernel machine, ICL-MoE uses it as an embedding for local experts, and FuseKernel fuses it with other kernels. Each is a first-class MoDeVa estimator: it trains through the ModelZoo, runs the whole TestSuite and returns a ValidationResult.

DirectRS

Tree ensembles are among the most accurate models for tabular data, and among the hardest to explain. DirectRS post-processes a pre-trained ensemble (XGBoost, LightGBM, CatBoost) without retraining it: it extracts a global stretch matrix from the tree structure, then fits a per-tree Ridge regression on the stretched embedding, replacing each tree's piecewise-constant leaf value with a piecewise-linear one.

f(x)=c0+j=1pcj(x)f(\mathbf{x}) = c_0 + \sum_{j=1}^{p} c_j(\mathbf{x})

The identity holds to machine precision — no sampling and no approximation, unlike post-hoc attribution. DirectRS supplies six interpretability methods: a global stretch analysis, exact local decomposition, four global-importance modes, a main-vs-interaction variance split, geometric interaction traces and a top pairwise-interaction table.

MoDirectRSRegressorMoDirectRSClassifier
DirectRS in the User Guide

GBDT Leaf Kernel

The GBDT leaf kernel re-reads a fitted ensemble rather than reshaping it. Every gradient-boosted prediction can be written as a weighted average of training labels, scores or residuals under the ensemble's own leaf co-membership kernel — two inputs are close when the trees route them to the same leaves. This turns an opaque GBDT into a nearest-neighbor model over a learned geometry and exposes the evidence behind each prediction without a separate surrogate.

It offers five interchangeable prediction heads — exact_gbdt, gnw_label, gnw_leaf, krr and residual_gnw — with a nominate_head procedure that selects one on validation evidence. Every prediction carries a Top-k Leaf-Evidence (TKLE) ledger, and predict_with_context swaps the training memory for a user-supplied pool while keeping the kernel fixed, which supports counterfactual and case-based audits without retraining.

MoGBDTKernelRegressorMoGBDTKernelClassifier
GBDT Leaf Kernel in the User Guide

FuseKernel

A single kernel encodes one prior over functions, and no one kernel is right for every dataset. FuseKernel forms a convex mixture of up to three channels — a tree co-membership kernel, an RBF kernel and a learned multi-scale spectral kernel — and decodes the mixture with a single kernel ridge:

f^(x)=cwcKc(x,S)(KSS+λI)1yS,wc0, cwc=1.\hat{f}(\mathbf{x}) = \sum_c w_c\, K_c(\mathbf{x}, \mathcal{S})\, (\mathbf{K}_{\mathcal{S}\mathcal{S}} + \lambda \mathbf{I})^{-1} \mathbf{y}_{\mathcal{S}}, \qquad w_c \ge 0,\ \sum_c w_c = 1.

The mixture weights and the ridge are chosen on a held-out query fold that no channel has trained on, which keeps the fusion from over-crediting a channel that memorizes its own training rows. FuseKernel exposes an inherent functional-ANOVA interpretation and closed-form Gaussian-process prediction intervals for reliability diagnostics without a conformal wrapper.

MoFuseKernelRegressorMoFuseKernelClassifier
FuseKernel in the User Guide

ICL-MoE

ICL-MoE (In-Context Learning Mixture of Experts) builds on a fitted DirectRS model. Two samples that land near each other in the DirectRS embedding share similar split-routing patterns across all trees, so proximity there is structural similarity from the model's perspective rather than raw feature proximity. ICL-MoE replaces hard tree-based leaf routing with soft k-nearest-neighbor attention gating in that space: for each query it finds its contextual neighbors and fits a local expert on them, correcting the DirectRS leaf experts with a kNN-weighted local Ridge on their residuals. This is the tabular analogue of in-context learning, where the context is the set of nearby training examples in the learned embedding.

MoDirectRSICLRegressorMoDirectRSICLClassifier
ICL-MoE in the User Guide

New validation diagnostics

Version 2.0 adds four diagnostics that locate where a model fails, not only how well it does on average. The first decomposes the aggregate error; the remaining three find and, in one case, repair the regions that drive it.

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=1Kj=1KwijAUCij\mathrm{AUC}_{\text{global}} = \sum_{i=1}^{K} \sum_{j=1}^{K} w_{ij}\, \mathrm{AUC}_{ij}

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ˉkyˉk)2+σf,k2+σy,k22Covk(f,y)\mathrm{MSE}_k = (\bar{f}_k - \bar{y}_k)^2 + \sigma^2_{f,k} + \sigma^2_{y,k} - 2\,\mathrm{Cov}_k(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

Packaging and licensing

MoDeVa 2.0 changes how the package is distributed:

Compiled distribution
The package ships as compiled extensions rather than editable source.
NumPy 1.x
MoDeVa 2.0 requires numpy<=1.26.4. Install it into an environment with NumPy 1.x; it will not import under NumPy 2.x.
License tiers
Access is governed by a signed license with tier quotas (DEMO, DEVELOPER, ENTERPRISE) that cap dataset rows, registered models and worker count. Dependency availability is checked at import.

Upgrading

Install into a fresh environment with NumPy 1.x and a license valid for your tier. The 1.x public API is unchanged, so existing DataSet, ModelZoo, TestSuite and Pipeline code runs without modification. The new models and diagnostics are additive.

These notes cover the 2.0 feature release. Later 2.x releases are maintenance updates — see the release history on PyPI for the current version. Questions about licensing or a walkthrough of the new models? Get in touch.