Repository navigation
v1.7.0 (2026-08-27) #593
mmschlk
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
v1.7.0 (2026-08-27)
New and Improved Tree support.
This release focuses on a greatly improved support of tree-based models as provided by sklearn, XGBoost, LightGBM, or CatBoost.
TreeExplainerremains the single entry point for explaining tree-based models and routes to the fastest available algorithms.With this release, tree explanations are numerically stable at any tree depth and substantially faster on all kinds of trees, in both
pathdependentandinterventionalmode.In
mode="pathdependent", explanations are now computed by the newQuadratureTreeSHAPalgorithm, which replaces the polynomial algorithmsLinearTreeSHAPandTreeSHAPIQas the default.In
mode="interventional", smaller inputs are computed byInterventionalTreeSHAPIQand larger inputs route to the new vectorized Woodelf fast path.All four algorithms share a common interface and can also be used directly, independently of
TreeExplainer.Woodelf-IQ integration #572
Together with Ron Wettenstein, we add a Woodelf fast path to
shapiq.tree.TreeExplainer(Nadel and Wettenstein, 2026; Wettenstein et al., 2026).Woodelf is very fast. It computes explanations fully vectorized over all explained instances and reference rows scaling much more favorably with large explanation points or reference data than existing algorithms.
It is also not limited to Shapley values and also computes interaction indices
"SII"and"k-SII"and Banzhaf values"BV""BII".TreeExplainer.explain_Xexplains all instances in one vectorized run and returns the newInteractionValuesBatch: a lazy sequence of oneInteractionValuesper instance whose.valuesattribute exposes the raw vectorized arrays (Explainer.explain_Xis now typed as returning aSequence[InteractionValues]).The fast path requires the new optional
treedependency group (pip install shapiq[tree]—woodelf-explainer); without it, the explainer falls back to the shapiq implementation with aWoodelfNotAvailableWarning.The new
backendparameter ("auto","woodelf","shapiq") overrides the automatic routing, whose cut-off between the two backends was benchmarked and set ton * m >= 100_000(nexplained instances ×mreference rows) #591.QuadratureSHAP #588
We add
QuadratureTreeSHAPinshapiq.tree.quadratureas the default path-dependent algorithm ofTreeExplainer, computing all supported indices ("SV","SII","k-SII","BV","BII") at any order natively replacingLinearTreeSHAPandTreeSHAPIQ.QuadratureTreeSHAPis a new efficientpathdependentTreeSHAP algorithm (Wettenstein et al., 2026; Li et al., 2026) computing Shapley values and any-order Shapley interactions ("SV","SII","k-SII") as well as the Banzhaf indices ("BV"/"BII") numerically exact in float64 at any tree depth and any number of features per decision path.This resolves the numerical instability of the existing polynomial algorithms which started at around 28 unique features per path #545.
QuadratureTreeSHAPis implemented with a C++ kernel that benchmarks substantially faster than the existing explainers at every measured setting.We see about 2× improvements vs
LinearTreeSHAP, which is the fastest algorithm for Shapley values and 100×+ vsTreeSHAPIQfor interactions.We can compute order-4 interactions in milliseconds.
Ensembles are computed in a single batched C++ kernel invocation over a shared feature space, which benchmarks at parity with XGBoost's native
pred_contribsTreeSHAP on a single thread.New LeverageSHAP Approximator #524, #583
Adds the
LeverageSHAPapproximator inshapiq.approximator.regressionfor Shapley value estimation via leverage score sampling (Musco and Witter, 2025).LeverageSHAPis the modernized variant ofKernelSHAPand should be used as a direct replacement improving sample-efficiency without additional costs.The implementation follows the paper's released implementation: a functional
pairing_trick, deterministic per-size sample counts (deterministic_counts=Trueby default), and exact budget accounting #583.Additional new Features
BIIandSTIItoProxySHAP(in addition toSV,BV,SII,k-SII,FSII, andFBII).ProxySHAPis registered for both indices whereversetup_approximatorresolves the"proxyshap"string.MoebiusConvertergained the matchingBIIconversion, and computesBVthrough it. #587k_foldsparameter toProxySHAPandRegressionMSRfor out-of-fold proxy residuals, i.e. the cross-fitting variant of Witter et al. (2025). The defaultk_folds=1fits a single proxy on all sampled coalitions, which the paper recommends in practice. #587RegressionMSRmore with the theory of the paper by adding sampling weights for theRegressionMSRestimator which are coherent to the papers proposed sampling Witter et al. (2025). #587TreeExplainersupport for scikit-learn gradient boosting models:GradientBoostingRegressor,GradientBoostingClassifier,HistGradientBoostingRegressor, andHistGradientBoostingClassifiercan now be converted to the internal tree format. #577HistGradientBoosting*(categorical_features), LightGBM (categorical_feature), and XGBoost (enable_categorical) -- are now converted and explained exactly on all paths (TreeSHAP-IQ, LinearTreeSHAP, Interventional TreeSHAP-IQ, and QuadratureSHAP).TreeModelstores per-node category sets in a CSR layout (cat_values/cat_start/cat_size) with the unified routing rule "category in set → left child, NaN → missing child". #577ConfoundingSHAPlocal and global explanation game inshapiq_games.benchmark.causal_xaifor the first causal machine learning based value functions (Brockschmidt et al., 2026) based on the paper. #551Breaking Changes
InterventionalTreeExplainertoInterventionalTreeSHAPIQinshapiq.tree.interventionalfor consistency withTreeSHAPIQ,LinearTreeSHAP, and the newly addedQuadratureSHAP. The old name is no longer available; importshapiq.tree.InterventionalTreeSHAPIQinstead. #580ProxySHAP'sadjustmentparameter into a boolean (defaultFalse;RegressionMSRalways applies it). The residual correction is now a built-in closed-form MSR routine rather than a second approximator, so the"svarm"and"kernel"variants are no longer available.random_state=Noneis also no longer silently replaced by a fixed seed, which the single shared coalition sampler makes unnecessary. #587RegressionMSR's defaultsampling_weightsto the closed-form kernel of Witter et al. (2025), including their separate Leverage-SHAP kernel for linear proxies withindex="SV". Passingsampling_weightsexplicitly still overrides the default. #587Bugfix
TreeModel.input_precision/cast_input(LightGBM compares in float64 and is untouched; sklearn's thresholds are exact midpoints of adjacent float32 values, making its internal cast unobservable). Previously all tree explainers could explain a different leaf than the model actually predicts — on measured XGBoosthistmodels roughly half the instances routed differently somewhere in the ensemble #588{6, 14}):reduce_feature_complexityassigned reduced ids in rawsetiteration order while the returnedinteraction_lookupsorts players, pairing values with the wrong features inTreeSHAPIQ. #588-ffast-mathhad compiled away thestd::isnanchecks (now built with-fno-finite-math-only), and TreeSHAP-IQ now routes NaN values through the per-node missing direction exactly likepredict_one#577STII/FSII/BIIcode path from the path-dependentTreeSHAPIQalgorithm, which crashed with broadcasting errors on wider trees.TreeSHAPIQnow raises a clearValueErrorfor indices other thanSV,SII, andk-SII. #571 #575KernelSHAPIQandInconsistentKernelSHAPIQfrom theSTII_APPROXIMATORSandFSII_APPROXIMATORSregistries inshapiq.approximator, since both only support theSV,SII, andk-SIIindices #571 #575BVindex losingestimatedandestimation_budgetwhen interactions are read out of a linear proxy:MoebiusConverternow computesBVthrough the base-interaction routine (as it already did forSV) instead of the faithful-index routine, which did not carry those fields through. #587Maintenance
LinearTreeSHAPandTreeSHAPIQnow emit aTreeNumericalPrecisionWarningfrom 24 distinct features per decision path (they become numerically unstable there) and raise aTreeNumericalPrecisionErrorfrom 30 (unreliable values), instead of silently returning wrong attributions or crashing with an unexplainedLinAlgError#545. #588ProxySHAP's MSR residual adjustment as a self-contained vectorized routine that estimates all interactions in a single matrix product over the coalitions already sampled, instead of re-sampling an independentCoalitionSamplerand running a second Monte Carlo pass on a residual game. #587Regression._init_kernel_weights(superseded by_init_log_kernel_weights) and theMonteCarlofamily_get_standard_form_weights/_weight/_sii_weight/_bii_weight/_chii_weight/_stii_weight/_fsii_weight/_fbii_weight(superseded by_get_standard_form_log_weightsand the_log_*_weightmethods). #578aggregate_base_attributions): all subset projections and Bernoulli weightings are built as array operations and summed per subset via integer-codedbincount, ~12–27× faster than the previous per-subset dict loop. #590KNNExplainer,WeightedKNNExplainer, and their ground-truth games now raise aValueErrorat construction when the model was fitted on fewer training samples thann_neighbors, mirroring scikit-learn's own "Expected n_neighbors <= n_samples_fit" error onpredict. Previously,KNNExplainersilently returned Shapley values that disagreed withKNNExplainerGamein this regime #582InterventionalTreeSHAPIQfor non-boolean trees to C++, for a ~263× end-to-end speedup: a fused dense kernel (compute_interactions_cohort) replaces the per-explanation Python E/R preprocessing with one DFS per tree that shares the walk across all reference samples, and the interventionalbaseline_valuenow routes the reference data through a C++ ensemble-prediction kernel (predict_ensemble_sum) instead of a Python per-(row, tree) loop (up to ~500× on large backgrounds). #590LinearTreeSHAP,TreeSHAPIQ,QuadratureTreeSHAP, andInterventionalTreeSHAPIQnow all validate their own models, accept ensembles as well as single trees (aggregating internally), take aclass_indexargument, and expose a commonexplain(x)entry point — each algorithm can be used independently ofTreeExplainer, which now simply instantiates one explainer per mode. Note that TreeExplainer is still the intended access points for users. Their modules are namedcomputer(shapiq.tree.linear.computer,shapiq.tree.quadrature.computer,shapiq.tree.interventional.computer), keepingshapiq.tree.explainerunambiguous as the user-facingTreeExplainerentry point. #588compute_interactions,compute_interactions_batched,compute_interactions_sparse) were removed #588New Contributors
Full Changelog: v1.6.0...v1.7.0
This discussion was created from the release v1.7.0 (2026-08-27).
All reactions