SHAP, LIME, and Integrated Gradients to Explain Your Models

Local and global explanations become essential with Article 13 of the European AI Act. Three approaches — SHAP, LIME, and Integrated Gradients — are tested against the same churn model, trained on controlled synthetic data, to compare their contributions without changing the playing field.
SHAP provides local and global explanations, version 0.52.0 as of May 28, 2026
SHAP delivers both global and local explanations based on the average marginal contribution of each feature, derived from cooperative game theory. The library is noted in version 0.52.0, released on May 28, 2026, and is presented as widely adopted for interpretability. The shared goal with LIME and Integrated Gradients is to make intelligible models that would otherwise be considered black boxes. These approaches address three combined limitations of usual practices: lack of local explanation, bias in importance calculation, and lack of coverage for other model families.
Transparency required and the difference between global and local
Article 13 of the European AI regulation mandates that, for high-risk systems, deployers must be able to genuinely interpret the results. The stakes go beyond mere predictive accuracy and become a condition for the deployment of an increasing number of systems. Interpretability is divided into two levels: global, to understand which features matter on average and in what direction, and local, to explain a given prediction. A model can provide a coherent global reading while remaining opaque for an individual case, such as when a customer with five years of tenure is classified as at risk without accessible justification.
Rapid importance attribution favors variable hierarchy
The common use of importance attributes like .feature_importances_ in scikit-learn ensemble models, or direct examination of coefficients in a linear model, allows for a quick hierarchy of variables. In the case of churn, tenure ranks first, followed by monthly rate, number of support tickets, contract type, and then late payments. However, this method remains purely global, tends to excessively favor high-cardinality variables, and is only available for models that offer this attribute. It does not apply to neural networks, heterogeneous ensembles, or black-box APIs.
Le brief IA que les pros lisent chaque soir
Les 7 actus IA du jour, décryptées en 5 min. Gratuit.
Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.
Choisissez votre rythme
Gratuit · Pas de spam · Désabonnement en 1 clic
A controlled testbed to compare explanations
A shared file constructs a synthetic churn dataset and trains a gradient-boosted tree, also accompanied by a small neural network on the same data to compare techniques. The random generator is initialized with seed 42, and the cohort consists of 2000 individuals. The variables include tenure in months between 1 and 72, a monthly rate drawn from a normal distribution with a mean of 70 and a standard deviation of 25 truncated between 15 and 200, support tickets following a Poisson distribution with a parameter of 1.5, a binary indicator for monthly contracts, and late payments from a Poisson distribution with a parameter of 0.8. The probability of churn comes from a logistic model with an intercept of -1.5 and coefficients of -0.04 for tenure, +0.015 for the rate, +0.35 for tickets, +1.1 for the monthly contract, and +0.25 for late payments, all passed through a sigmoid, then thresholded via a uniform draw. The data is split with a test_size of 0.2 and a random_state of 42, and a GradientBoostingClassifier with random_state 42 is trained. Random noise is injected to avoid a too-clean signal, and prior knowledge of churn drivers serves as a reference to assess the plausibility of explanations. Upon execution, a test accuracy of 0.698 is reported, with an average churn rate of 36.8%. The same reference customer, X_test.iloc[0], with 53 months of tenure and 5 recent tickets, is used for all three methods to compare explanations on an identical case.
Environment and dependencies to reproduce results
Reproduction is done with Python 3.11 or higher. The dependencies to install include shap, lime, scikit-learn, pandas, numpy, torch, and captum. The scripts display training and testing accuracy metrics in three decimal format, as well as the average churn rate, to verify the proper execution of the training.
Brief IA — L'actualité IA en français
L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.