Interpreting Machine Learning Predictions with SHAP and LIME for Transparent Decision Making
Stow, May and Stewart, Ashley Ajumoke
Abstract
Machine learning models increasingly influence critical decisions across diverse domains, yet their complex architectures often operate as black boxes, obscuring the rationale behind predictions and limiting stakeholder trust. This research demonstrates a comprehensive, reproducible workflow for applying explainable artificial intelligence techniques to interpret Random Forest classifier decisions using publicly available data and standard computational resources. The study implements and compares two leading explanation methods, SHAP (SHapley Additive exPlanations) and LIME (Local Interpretable Model-agnostic Explanations), on the Titanic survival prediction task to evaluate their consistency and practical utility. The methodology encompasses automated data preprocessing, model training with regularization to prevent overfitting, and systematic generation of both global and local explanations through multiple visualization formats. Results reveal exceptional agreement between explanation methods, with Spearman rank correlation of 0.918 and Pearson correlation of 0.982 for feature importance values. Both techniques consistently identified passenger sex as the dominant predictive feature, contributing approximately 15.4% and 12.5% of model decisions respectively, followed by passenger class and fare. The Random Forest model achieved 84.5% test set ROC-AUC with controlled overfitting (0.040 ROC-AUC gap between training and test sets) while maintaining interpretable complexity through architectural constraints. The implementation executes efficiently on CPU hardware within minutes, eliminating computational barriers to XAI adoption. This work establishes that current explainability techniques can provide reliable, consistent insights into ensemble model decisions while remaining accessible to researchers and practitioners with limited computational resources.
Keywords
References
dependent: More accurate approximations to Shapley values. Artificial Intelligence,
298, 103502. https://doi.org/10.1016/j.artint.2021.103502
Adadi, A., & Berrada, M. (2018). Peeking inside the black-box: A survey on explainable
artificial
intelligence
(XAI).
IEEE
Access,
6,
52138-52160.
https://doi.org/10.1109/ACCESS.2018.2870052
Bhatt, U., Xiang, A., Sharma, S., Weller, A., Taly, A., Jia, Y., Ghosh, J., Puri, R., Moura, J. M.
F., & Eckersley, P. (2020). Explainable machine learning in deployment. In
Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency
(pp. 648-657). https://doi.org/10.1145/3351095.3375624
Bracke, P., Datta, A., Jung, C., & Sen, S. (2019). Machine learning explainability in finance:
An application to default risk analysis. Bank of England Working Paper No. 816.
https://doi.org/10.2139/ssrn.3435104
Chen, J., Song, L., Wainwright, M. J., & Jordan, M. I. (2019). L-Shapley and C-Shapley:
Efficient model interpretation for structured data. In International Conference on
Learning Representations. https://doi.org/10.48550/arXiv.1808.02610
Covert, I., Lundberg, S., & Lee, S. I. (2020). Understanding global feature contributions with
additive importance measures. In Advances in Neural Information Processing Systems
33 (NeurIPS 2020) (pp. 17212-17223). https://doi.org/10.48550/arXiv.2004.00668
Guidotti, R., Monreale, A., Ruggieri, S., Turini, F., Giannotti, F., & Pedreschi, D. (2018). A
survey of methods for explaining black box models. ACM Computing Surveys, 51(5),
1-42. https://doi.org/10.1145/3236009
Kumar, E., Venkatasubramanian, S., Scheidegger, C., & Friedler, S. (2020). Problems with
Shapley-value-based explanations as feature importance measures. In Proceedings of
the 37th International Conference on Machine Learning (pp. 5491-5500).
https://doi.org/10.48550/arXiv.2002.11097
Kumar, I. E., Venkatasubramanian, S., Scheidegger, C., & Friedler, S. (2021). Shapley
residuals: Quantifying the limits of the Shapley value for explanations. In Advances in
Neural Information Processing Systems 34 (NeurIPS 2021) (pp. 26598-26608).
https://doi.org/10.48550/arXiv.2106.14139
Lauritsen, S. M., Kristensen, M., Olsen, M. V., Larsen, M. S., Lauritsen, K. M., Jørgensen, M.
J., Lange, J., & Thiesson, B. (2020). Explainable artificial intelligence model to predict
acute critical illness from electronic health records. Nature Communications, 11(1),
https://doi.org/10.1038/s41467-020-17431-x
Lipton, Z. C. (2018a). The mythos of model interpretability. Queue, 16(3), 31-57.
https://doi.org/10.1145/3236386.3241340
Lipton, Z. C. (2018b). The mythos of model interpretability: In machine learning, the concept
of interpretability is both important and slippery. Communications of the ACM, 61(10),
36-43. https://doi.org/10.1145/3233231
Lundberg, S. M., Erion, G., Chen, H., DeGrave, A., Prutkin, J. M., Nair, B., Katz, R.,
Himmelfarb, J., Bansal, N., & Lee, S. I. (2020). From local explanations to global
understanding with explainable AI for trees. Nature Machine Intelligence, 2(1), 56-67.
https://doi.org/10.1038/s42256-019-0138-9
Lundberg, S. M., & Lee, S. I. (2017). A unified approach to interpreting model predictions. In
Advances in Neural Information Processing Systems 30 (NIPS 2017) (pp. 4765-4774).
https://doi.org/10.48550/arXiv.1705.07874
Molnar, C. (2022). Interpretable machine learning: A guide for making black box models
explainable (2nd ed.). https://christophm.github.io/interpretable-ml-book/
Mothilal, R. K., Sharma, A., & Tan, C. (2020). Explaining machine learning classifiers through
diverse counterfactual explanations. In Proceedings of the 2020 Conference on
Fairness,
Accountability,
and
Transparency
(pp.
607-617).
https://doi.org/10.1145/3351095.3372850
Ribeiro, M. T., Singh, S., & Guestrin, C. (2016). Why should I trust you? Explaining the
predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International
Conference on Knowledge Discovery and Data Mining (pp. 1135-1144).
https://doi.org/10.1145/2939672.2939778
Rudin, C. (2019a). Stop explaining black box machine learning models for high stakes
decisions and use interpretable models instead. Nature Machine Intelligence, 1(5), 206-
https://doi.org/10.1038/s42256-019-0048-x
Rudin, C. (2019b). Please stop explaining black box models for high stakes decisions. In
Proceedings of the Conference on Neural Information Processing Systems.
https://doi.org/10.48550/arXiv.1811.10154
Slack, D., Hilgard, S., Jia, E., Singh, S., & Lakkaraju, H. (2020). Fooling LIME and SHAP:
Adversarial attacks on post hoc explanation methods. In Proceedings of the
AAAI/ACM
Conference
on
AI,
Ethics,
and
Society
(pp.
180-186).
https://doi.org/10.1145/3375627.3375830
Sundararajan, M., Taly, A., & Yan, Q. (2017). Axiomatic attribution for deep networks. In
Proceedings of the 34th International Conference on Machine Learning (pp. 3319-
3328). https://doi.org/10.48550/arXiv.1703.01365
Ustun, B., Spangher, A., & Liu, Y. (2019). Actionable recourse in linear classification. In
Proceedings of the Conference on Fairness, Accountability, and Transparency (pp. 10-
19). https://doi.org/10.1145/3287560.3287566
Wachter, S., Mittelstadt, B., & Floridi, L. (2017). Why a right to explanation of automated
decision-making does not exist in the general data protection regulation. International