Skip to main content

Optimal Counterfactual Explanations for k-Nearest Neighbors Using Mathematical Optimization and Constraint Programming

  • Conference paper
  • First Online:
Combinatorial Optimization (ISCO 2024)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14594))

Included in the following conference series:

  • 372 Accesses

Abstract

Within the topic of explainable AI, counterfactual explanations to classifiers have received significant recent attention. We study counterfactual explanations that try to explain why a data point received an undesirable classification by providing the closest data point that would have received a desirable one. Within the context of one the simplest and most popular classification models—k-nearest neighbors (k-NN)—the solution to such optimal counterfactual explanation is still very challenging computationally. In this work, we present techniques that significantly improve the computational times to find such optimal counterfactual explanations for k-NN.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.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

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Achterberg, T.: Constraint integer programming. Ph.D. thesis, TU Berlin (2007)

    Google Scholar 

  2. Artelt, A., Hammer, B.: On the computation of counterfactual explanations – a survey (2019). https://arxiv.org/abs/1911.07749

  3. Dolan, E.D., Moré, J.J.: Benchmarking optimization software with performance profiles. Math. Program. 91, 201–213 (2002)

    Article  MathSciNet  Google Scholar 

  4. Forel, A., Parmentier, A., Vidal, T.: Explainable data-driven optimization: from context to decision and back again. In: 40th International Conference on Machine Learning (ICML 2023) (2023). https://publications.polymtl.ca/56889/

  5. Guidotti, R.: Counterfactual explanations and how to find them: literature review and benchmarking. Data Min. Knowl. Discov. 1–55 (2022)

    Google Scholar 

  6. Gurobi Optimization, LLC: Gurobi Optimizer Reference Manual (2023). https://www.gurobi.com

  7. Parmentier, A., Vidal, T.: Optimal counterfactual explanations in tree ensembles. In: International Conference on Machine Learning, pp. 8422–8431. PMLR (2021)

    Google Scholar 

  8. Pedregosa, F., et al.: Scikit-learn: machine learning in python. J. Mach. Learn. Res. 12(Oct), 2825–2830 (2011)

    MathSciNet  Google Scholar 

  9. Perron, L., Didier, F.: CP-SAT. https://developers.google.com/optimization/cp/cp_solver/

  10. Roland, M., Forel, A., Vidal, T.: Adaptive partitioning for chance-constrained problems with finite support (2023). https://arxiv.org/abs/2312.13180

  11. Russell, C.: Efficient search for diverse coherent explanations. In: Proceedings of the Conference on Fairness, Accountability, and Transparency, pp. 20–28 (2019)

    Google Scholar 

  12. Song, Y., Luedtke, J.: An adaptive partition-based approach for solving two-stage stochastic programs with fixed recourse. SIAM J. Optim. 25(3), 1344–1367 (2015)

    Article  MathSciNet  Google Scholar 

  13. Vu, D.M., Hewitt, M., Boland, N., Savelsbergh, M.: Dynamic discretization discovery for solving the time-dependent traveling salesman problem with time windows. Transp. Sci. 54(3), 703–720 (2020)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ricardo Fukasawa .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 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

Contardo, C., Fukasawa, R., Rousseau, LM., Vidal, T. (2024). Optimal Counterfactual Explanations for k-Nearest Neighbors Using Mathematical Optimization and Constraint Programming. In: Basu, A., Mahjoub, A.R., Salazar González, J.J. (eds) Combinatorial Optimization. ISCO 2024. Lecture Notes in Computer Science, vol 14594. Springer, Cham. https://doi.org/10.1007/978-3-031-60924-4_24

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-60924-4_24

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-60923-7

  • Online ISBN: 978-3-031-60924-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics