What's Changed
Highlights
- Native bindings rewritten with nanobind, and the build system migrated
fromsetup.pyto scikit-build-core + CMake. The Cython
_kernel_lib.pyxand the existing_cext/_cext_gpumodules are now
built as nanobind extensions, andMANIFEST.in/setup.pyhave been
removed in favor of apyproject.toml-driven build. (#4366, by
@CloseChoice and @daidahao and @claude) - Minimum dependency versions raised to follow SPEC 0. (#4310, by @CloseChoice)
Enhancements
- Log an
INFOmessage when background data is sub-sampled (closes #3461).
(#4294, by @Ebube22) - Add cross-links between the API Reference and API Examples pages.
(#4329, by @Abhishek9639) - Drop the unused
typing-extensionsdependency. (#4629, by @samudraneel05)
Bug Fixes
- Improve GPU TreeExplainer parity: preserve XGBoost default/missing child
routing so NaN values follow the same branch as the source model, preserve
vector-valued XGBoostbase_scorevalues (fixing multiclass additivity
offsets), and tighten categorical handling so sklearn models with
enable_categorical=Trueraise the existing unsupported-categorical error
even when the booster does not exposefeature_types. (#4997, by
@RAMitchell) - TreeExplainer no longer crashes with pandas nullable dtypes.
(#4298, by @tudstudent) - Fix
NameErrorwhenwith_binary=Falseandwith_cuda=Trueby
initializingcompile_args. (#4322, by @mohityadav8) - Text plot colors render correctly by converting NumPy types to float.
(#4332, by @Saloni-0465) - Assign the result of
np.flipudso it is no longer a no-op in
AdditiveForceArrayVisualizer. (#4343, by @Mahaveerjain-18) - Use
isinstance()instead ofisfor type checks. (#4373, by @divyam-jha123) - Record
'sample'inExplanation.op_historyinstead of'__getitem__'.
(#4376, by @tarun-227) - Move the unreachable large-dataset warning into the interventional branch.
(#4392, by @Mahaveerjain-18) - Fix "structure of inputs doesn't match the expected structure".
(#4410, by @shaivimalik) - Fix the return value from
is_color_map()inplots/_beeswarm.py.
(#4421, by @maniktyagi04) - Suppress the
UserWarningwhenLGBMRegressorwas fitted with feature
names. (#4422, by @shaivimalik) - Correct
max_evalscalculation inPermutationExplainer.shap_values().
(#4434, by @AftAb-25) - Fix incorrect measure calls in
benchmark/metrics.py.
(#4447, by @Jiya873) - Handle zero division in the heatmap when all SHAP values are zero.
(#4449, by @BaibhavKundu2005) - Correct file path handling in
make_dir(image.py).
(#4501, by @Abhishek-Kumar-Rai5) - Use
isinstance()instead oftype() isfor tuple checks.
(#4508, by @neha222222) - Warn when the covariance matrix is singular in LinearExplainer.
(#4471, by @BaibhavKundu2005) - Remove a debug print and a typo in
serializable.
(#4336, by @dhiraj-143r)
Maintenance
- Fix a NumPy deprecation warning in the coalition explainer.
(#4291, by @CloseChoice) - Fix deprecated NumPy dtype aliases in
test_kernel.py.
(#4302, by @peteroyce) - Replace the deprecated
input_shapekwarg with anInputlayer in tests.
(#4301, by @kvr06-ai) - Replace deprecated
return_all_scoreswithtop_k=None(#3974).
(#4393, by @shauryam2807) - Remove dead code in
utils/_keras.py(unused and broken on Keras 3).
(#4625, by @SuMayaBee) - Remove the dead
__check_cachefunction and stale cache variables in
benchmark. (#4485, by @dhiraj-143r) - Update bundled JS. (#4308, by @CloseChoice)
Type Hints
- Add type hints for
explainers.other._random. (#4436, by @SarthakB11)
Tests
- Add SHAP values baselines. (#4307, by @CloseChoice)
- Add more exact explainer
#4366tests. (#4312, by @CloseChoice) - Re-enable causalml tests. (#4311, by @dhiraj-143r)
- Make force plot tests deterministic to fix macOS flakiness (#4102).
(#4315, by @Abhishek9639) - Add a new exact explainer test. (#4364, by @CloseChoice)
- Use the default matplotlib style for tests. (#4330, by @Anushreebasics)
- Restore pytest discovery for
shap.actions. (#4350, by @JRV7903) - Improve test coverage for the Action base class. (#4514, by @Jiya873)
- Add tests in
tests/explainers/test_linear.py. (#4416, by @naxatra2) - Increase test coverage for
shap/explainers/other/_treegain.py.
(#4427, by @rupeshca007)
Documentation
- Update LightGBM links. (#4296, by @jameslamb)
- Fix Python installation version from 3.11 to 3.12. (#4319, by @kronzter)
- Fix a broken link. (#4400, by @Jiya873)
- Update the Iris classification notebook to use the modern SHAP API.
(#4318, by @JRV7903) - Fix typos in the heatmap notebook. (#4359, by @Bot87Ever)
- Reformat the waterfall notebook. (#4378, by @justin212407)
- Improve clarity and documentation in the sentiment analysis notebook.
(#4397, by @24f3004086) - Improve the embedding plot docstring. (#4438, by @Jiya873)
- Modernize the "Fitting a Linear Simulation with XGBoost" notebook.
(#4428, by @vibhor-5) - Fix spelling errors in source code docstrings and comments.
(#4446, by @rupeshca007) - Clarify the
expected_valuemath formula in TreeExplainer (#4414).
(#4418, by @DashratRajpurohit)
New Contributors
- @daidahao made their first contribution in #4366
- @peteroyce made their first contribution in #4302
- @kvr06-ai made their first contribution in #4301
- @dhiraj-143r made their first contribution in #4311
- @Abhishek9639 made their first contribution in #4315
- @kronzter made their first contribution in #4319
- @Jiya873 made their first contribution in #4400
- @shauryam2807 made their first contribution in #4393
- @Ebube22 made their first contribution in #4294
- @JRV7903 made their first contribution in #4318
- @mohityadav8 made their first contribution in #4322
- @Saloni-0465 made their first contribution in #4332
- @Anushreebasics made their first contribution in #4330
- @Bot87Ever made their first contribution in #4359
- @SuMayaBee made their first contribution in #4625
- @divyam-jha123 made their first contribution in #4373
- @justin212407 made their first contribution in #4378
- @samudraneel05 made their first contribution in #4629
- @Mahaveerjain-18 made their first contribution in #4392
- @24f3004086 made their first contribution in #4397
- @shaivimalik made their first contribution in #4410
- @tarun-227 made their first contribution in #4376
- @maniktyagi04 made their first contribution in #4421
- @naxatra2 made their first contribution in #4416
- @rupeshca007 made their first contribution in #4427
- @vibhor-5 made their first contribution in #4428
- @SarthakB11 made their first contribution in #4436
- @AftAb-25 made their first contribution in #4434
- @DashratRajpurohit made their first contribution in #4418
- @Abhishek-Kumar-Rai5 made their first contribution in #4501
- @BaibhavKundu2005 made their first contribution in #4449
- @neha222222 made their first contribution in #4508
Full Changelog: v0.51.0...v0.52.0