Efficient Computation of Shap Explanation Scores for Neural Network Classifiers via Knowledge Compilation

  • Conference paper
  • First Online:
Logics in Artificial Intelligence (JELIA 2023)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 14281))

Included in the following conference series:

  • 440 Accesses

Abstract

The use of Shap scores has become widespread in Explainable AI. However, their computation is in general intractable, in particular when done with a black-box classifier, such as neural network. Recent research has unveiled classes of open-box Boolean Circuit classifiers for which Shap can be computed efficiently. We show how to transform binary neural networks into those circuits for efficient Shap computation. We use logic-based knowledge compilation techniques. The performance gain is huge, as we show in the light of our experiments.

L. Bertossi—Member of the Millennium Institute for Foundational Research on Data (IMFD, Chile).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free ship** worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    California Housing Prices dataset: https://www.kaggle.com/datasets/camnugent/california-housing-prices.

  2. 2.

    The path in (2) is not the only way to obtain a dDBC. For example, [33] describe a conversion of BNNs into OBDDs, which can also be used to obtain dDBCs. However, the asymptotic time complexity is basically the same.

  3. 3.

    We could also used binarized sigmoid and softmax functions.

  4. 4.

    At this point is where using \(1,-1\) in the BNN instead of 1, 0 becomes useful.

  5. 5.

    We say “a CNF” meaning “a formula in CNF”. Similarly in plural.

  6. 6.

    Extending OBDDs, whose vtrees make variables in a path always appear in the same order. This generalization makes SDDs much more succinct than OBDDs [6, 7, 36].

  7. 7.

    Binarization could be achieved in other ways, depending on the feature, for better interaction with the feature independence assumption.

  8. 8.

    The experiments were run on Google Colab (with an NVIDIA Tesla T4 enabled). Algorithm 1 was programmed in Python. The complete code for Google Colab can be found at: https://github.com/Jorvan758/dDBCSFi2.

  9. 9.

    As done in [4], but with only the entity sample.

References

  1. Arenas, M., Barceló, P., Bertossi, L., Monet, M.: On the complexity of SHAP-score-based explanations: tractability via knowledge compilation and non-approximability results. J. Mach. Learn. Res. 24(63), 1–58 (2023). Extended version of [2]

    Google Scholar 

  2. Arenas, M., Barceló, P., Bertossi, L., Monet, M.: The tractability of SHAP-score-based explanations for classification over deterministic and decomposable Boolean circuits. In: Proceedings of the 35th AAAI Conference on Artificial Intelligence, pp. 6670–6678 (2021)

    Google Scholar 

  3. Audemard, G., Koriche, F., Marquis, P.: On tractable XAI queries based on compiled representations. In: Proceedings KR 2020, pp. 838–849 (2020)

    Google Scholar 

  4. Bertossi, L., Li, J., Schleich, M., Suciu, D., Vagena, Z.: Causality-based explanation of classification outcomes. In: Proceedings of the 4th International Workshop on “Data Management for End-to-End Machine Learning” (DEEM) at ACM SIGMOD/PODS, pp. 1–10 (2020). Posted as Corr ar**v Paper ar**v:2003.06868

  5. Bertossi, L.: Declarative approaches to counterfactual explanations for classification. Theory Pract. Logic Program. 23(3), 559–593 (2023)

    Article  MathSciNet  Google Scholar 

  6. Bollig, B., Buttkus, M.: On the relative succinctness of sentential decision diagrams. Theory Comput. Syst. 63(6), 1250–1277 (2019)

    Article  MathSciNet  MATH  Google Scholar 

  7. Bova, S.: SDDs are exponentially more succinct than OBDDs. In: Proceedings of the 30th AAAI Conference on Artificial Intelligence, pp. 929–935 (2016)

    Google Scholar 

  8. Bryant, R.E.: Graph-based algorithms for Boolean function manipulation. IEEE Trans. Comput. C-35(8), 677–691 (1986)

    Google Scholar 

  9. Choi, A., Darwiche, A.: Dynamic minimization of sentential decision diagrams. In: Proceedings of the 27th AAAI Conference on Artificial Intelligence, pp. 187–194 (2013)

    Google Scholar 

  10. Choi, A., Darwiche, A.: SDD Advanced-User Manual Version 2.0. Automated Reasoning Group, UCLA (2018)

    Google Scholar 

  11. Darwiche, A., Hirth, A.: On the reasons behind decisions. In: Proceedings of the 24th European Conference on Artificial Intelligence, pp. 712–720 (2020)

    Google Scholar 

  12. Darwiche, A., Marquis, P.: A knowledge compilation map. J. Artif. Intell. Res. 17(1), 229–264 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  13. Darwiche, A.: On the tractable counting of theory models and its application to truth maintenance and belief revision. J. Appl. Non-Classical Logics 11(1–2), 11–34 (2011)

    MathSciNet  MATH  Google Scholar 

  14. Darwiche, A.: SDD: a new canonical representation of propositional knowledge bases. In: Proceedings of the 22th International Joint Conference on Artificial Intelligence (IJCAI 2011), pp. 819–826 (2011)

    Google Scholar 

  15. Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer, Heidelberg (2006). https://doi.org/10.1007/3-540-29953-X

    Book  MATH  Google Scholar 

  16. Guidotti, R., Monreale, A., Ruggieri, S., Turini, F., Giannotti, F., Pedreschi, D.: A survey of methods for explaining black box models. ACM Comput. Surv. 51(5), 1–42 (2018)

    Article  Google Scholar 

  17. Hubara, I., Courbariaux, M., Soudry, D., El-Yaniv, R., Bengio, Y.: Binarized neural networks. In: Proceedings of the NIPS 2016, pp. 4107–4115 (2016)

    Google Scholar 

  18. Lundberg, S.M., Lee, S.-I.: A unified approach to interpreting model predictions. In: Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 4768–4777 (2017). ar**v Paper ar**v:1705.07874

  19. Lundberg, S., et al.: From local explanations to global understanding with explainable AI for trees. Nat. Mach. Intell. 2(1), 56–67 (2020). ar**v Paper ar**v:1905.04610

  20. Manthey, N.: RISS tool collection (2017). https://github.com/nmanthey/riss-solver

  21. Meert, W., Choi, A.: Python Wrapper Package to Interactively Use Sentential Decision Diagrams (SDD) (2018). https://github.com/wannesm/PySDD

  22. Nakamura, K., Denzumi, S., Nishino, M.: Variable shift SDD: a more succinct sentential decision diagram. In: Proceedings of the 18th International Symposium on Experimental Algorithms (SEA 2020). Leibniz International Proceedings in Informatics, vol. 160, pp. 22:1–22:13 (2020)

    Google Scholar 

  23. Narodytska, N., Kasiviswanathan, S., Ryzhyk, L., Sagiv, M., Walsh, T.: Verifying properties of binarized deep neural networks. In: Proceedings of the 32nd AAAI Conference on Artificial Intelligence, pp. 6615–6624 (2018)

    Google Scholar 

  24. Nugent, C.: California Housing Prices (2018). https://www.kaggle.com/datasets/camnugent/california-housing-prices

  25. Oztok, U., Darwiche, A.: On compiling CNF into decision-DNNF. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 42–57. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10428-7_7

    Chapter  Google Scholar 

  26. Oztok, U., Darwiche, A.: On compiling DNNFs without determinism (2017). ar**v:1709.07092

  27. Qin, H., Gong, R., Liu, X., Bai, X., Song, J., Sebe, N.: Binary neural networks: a survey. Pattern Recogn. 105, 107281 (2020)

    Article  Google Scholar 

  28. Ras, G., **e, N., van Gerven, M., Doran, D.: Explainable deep learning: a field guide for the uninitiated. J. Artif. Intell. Res. 73, 329–396 (2022)

    Article  MathSciNet  MATH  Google Scholar 

  29. Roth, A.: The Shapley Value: Essays in Honor of Lloyd S. Shapley. Cambridge University Press (1988)

    Google Scholar 

  30. Rudin, C.: Stop explaining black box machine learning models for high stakes decisions and use interpretable models instead. Nat. Mach. Intell. 1, 206–215 (2019). ar**v Paper ar**v:1811.10154

  31. Shapley, L.S.: A value for n-person games. In: Contributions to the Theory of Games (AM-28), vol. 2, pp. 307–318 (1953)

    Google Scholar 

  32. Shih, A., Van den Broeck, G., Beame, P., Amarilli, A.: Smoothing structured decomposable circuits. In: Proceedings of the NeurIPS (2019)

    Google Scholar 

  33. Shi, W., Shih, A., Darwiche, A., Choi, A.: On tractable representations of binary neural networks. In: Proceedings of the 17th International Conference on Principles of Knowledge Representation and Reasoning, pp. 882–892 (2020)

    Google Scholar 

  34. Shih, A., Darwiche, A., Choi, A.: Verifying binarized neural networks by Angluin-Style learning. In: Janota, M., Lynce, I. (eds.) SAT 2019. LNCS, vol. 11628, pp. 354–370. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-24258-9_25

    Chapter  Google Scholar 

  35. Simons, T., Lee, D.-J.: A review of binarized neural networks. Electronics 8(6), 661 (2019)

    Article  Google Scholar 

  36. Van den Broeck, G., Darwiche, A.: On the role of canonicity in knowledge compilation. In: Proceedings of the 29th AAAI Conference on Artificial Intelligence, pp. 1641–1648 (2015)

    Google Scholar 

  37. Van den Broeck, G., Lykov, A., Schleich, M., Suciu, D.: On the tractability of SHAP explanations. In: Proceedings of the 35th AAAI Conference on Artificial Intelligence, pp. 6505–6513 (2021)

    Google Scholar 

Download references

Acknowledgments

Special thanks to Arthur Choi, Andy Shih, Norbert Manthey, Maximilian Schleich and Adnan Darwiche, for their valuable help. Work was funded by ANID - Millennium Science Initiative Program - Code ICN17002; CENIA, FB210017 (Financiamiento Basal para Centros Científicos y Tecnológicos de Excelencia de ANID), Chile; SKEMA Business School, and NSERC-DG 2023-04650. L. Bertossi is a Professor Emeritus at Carleton University, Canada.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Leopoldo Bertossi .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Bertossi, L., León, J.E. (2023). Efficient Computation of Shap Explanation Scores for Neural Network Classifiers via Knowledge Compilation. In: Gaggl, S., Martinez, M.V., Ortiz, M. (eds) Logics in Artificial Intelligence. JELIA 2023. Lecture Notes in Computer Science(), vol 14281. Springer, Cham. https://doi.org/10.1007/978-3-031-43619-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-43619-2_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-43618-5

  • Online ISBN: 978-3-031-43619-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics

Navigation