Repository navigation
feat(inspection): add Accumulated Local Effects (ALE) and AccumulatedLocalEffectsDisplay - #34950
Shikhar-Kesharwani wants to merge 1 commit into
Conversation
…LocalEffectsDisplay Implements Accumulated Local Effects (ALE) as requested in scikit-learn#30223. ALE calculates local differences in predictions over conditional intervals, preventing the distortion caused by correlated features in standard Partial Dependence Plots (PDP). - Add accumulated_local_effects computation engine in sklearn.inspection._accumulated_local_effects. - Add AccumulatedLocalEffectsDisplay in sklearn.inspection._plot.accumulated_local_effects. - Export both in sklearn.inspection.__init__. - Add comprehensive unit test suites covering regression, binary classification, multiclass classification, multi-target output, and plotting utilities. Fixes scikit-learn#30223 Signed-off-by: Shikhar Kesharwani <[email protected]>
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
❌ Linting issuesThis PR is introducing linting issues. Here's a summary of the issues. Note that you can avoid having linting issues by enabling You can see the details of the linting issues under the
|
virchan
left a comment
There was a problem hiding this comment.
Thank you for the PR, @Shikhar-Kesharwani.
As I write this, #30223 is still being voted on by the maintainers. Until that vote is resolved, PRs proposing a fix for this issue are unlikely to be reviewed.
With that said, I'm closing this PR.
Summary of Changes
Fixes #30223
This PR implements Accumulated Local Effects (ALE) for continuous features in
sklearn.inspection, providing a local-difference alternative to Partial Dependence Plots (PDP) that eliminates extrapolation distortion under correlated features.Motivation & Background
As discussed and approved in #30223:$\mathbb{E}_{X_c}[f(x_s, X_c)]$ , which forces models to evaluate unrealistic or impossible feature combinations when predictors are strongly correlated.
Partial Dependence evaluates marginal expectations
ALE (Apley & Zhu, 2020) resolves this by:
What this PR adds:
accumulated_local_effects(estimator, X, features, *, ...)insklearn/inspection/_accumulated_local_effects.pyreturning aBunch(ale,values,grid_values,feature_names).AccumulatedLocalEffectsDisplayinsklearn/inspection/_plot/accumulated_local_effects.pywith.plot()and.from_estimator()adhering to scikit-learn display standards.sklearn/inspection/__init__.py.test_accumulated_local_effects.py: Verifies analytical coefficient recovery on 95% correlated linear models, binary & multiclass classification, multi-target regression, sample weights, pandas DataFrame inputs, and input validation.test_plot_accumulated_local_effects.py: Verifiesfrom_estimator, multi-axis subplots, custom axes, and multiclass target selection.Signed-off-by: Shikhar Kesharwani [email protected]