<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Aberdeen, Scotland
$ betul.bayrak@ntnu.no (B. Bayrak)
 https://www.ntnu.edu/employees/betul.bayrak/ (B. Bayrak)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Beyond Post-Hoc Instance-Based Explanation Methods</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Betül Bayrak</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Norwegian University of Science and Technology (NTNU)</institution>
          ,
          <addr-line>Høgskoleringen 1, Trondheim, 7034</addr-line>
          ,
          <country country="NO">Norway</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>With the increasing demand for understanding the decision-making processes of artificial intelligence applications, explainable AI (XAI) systems have become increasingly important. Counterfactual explanations, a promising approach in XAI, take advantage of human counterfactual reasoning mechanisms to ofer intuitive explanations of how a model's predictions could have been diferent. This Ph.D. project focuses on the design of post-hoc XAI techniques to generate counterfactual explanations that utilize case-based reasoning. It highlights the benefits of post-hoc explanation systems in improving our understanding of black-box models and explores the unique advantages of counterfactual explanations as an instance-based method. Furthermore, this report presents an overview of my doctoral studies and current state. It contributes to the growing body of research on XAI by presenting novel insights into the design of post-hoc XAI systems. Additionally, the report identifies areas in the existing literature that require further investigation and suggests potential directions for future research. Overall, this report ofers valuable insights for researchers and practitioners interested in the design of XAI systems and highlights the importance of transparency and interpretability in artificial intelligence.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Counterfactual Explanation Generation</kwd>
        <kwd>Explainable Artificial Intelligent (XAI)</kwd>
        <kwd>Explainable Case-Based Reasoning (XCBR)</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The increasing prevalence of artificial intelligence models in various aspects of our daily lives
has created a growing need to understand how these models make decisions. However, the
complexity of these models has made it challenging to comprehend the factors that contribute
to their predictions. For instance, consider two individuals with similar backgrounds applying
for a home loan from a bank that uses a black-box model to assess loan applications. As shown
in Figure 1, one applicant is declined, while the other is approved, leaving the rejected applicant
wondering about the reasons behind their application’s rejection. Counterfactual explanations,
which are a type of post-hoc explanation, can provide highly satisfactory explanations in such
situations [
        <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
        ].
      </p>
      <p>
        Counterfactual explanations aim to answer the "what if ?" question by presenting hypothetical
examples that demonstrate how a model’s prediction can be changed with minimal efort. For
example, counterfactual explanations answer the "What if the rejected applicant had earned
$500 more? Would their application have been accepted?" questions. These explanations ofer
valuable insights that can help users understand the predictions made by black-box models,
particularly when the factors influencing the model’s decision are unclear [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>
        Explanation generation in Explainable AI (XAI) applications has diferent purposes and
approaches. Nunes and Jannach’s study [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] listed 17 diferent explanation types under four
categories and emphasized the importance of considering the aim of the explanation in the
explanation generation process. From another perspective, Arrieta et al.’s paper [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] discusses
two diferent approaches for creating explanations, model-dependent and model-agnostic
explanation systems. Model-dependent explanation systems are designed for specific models,
whereas model-agnostic explanation systems can perform with any model, regardless of its
structure or complexity.
      </p>
      <p>
        Another challenge in XAI applications is generating or selecting the best explanation for a
case, which requires essential quality metrics, such as trustworthiness, understandability,
informativeness, suficiency, and unbiasedness. There are various approaches from diferent fields
to meet these quality requirements, including the Case-Based Reasoning (CBR) methodology.
CBR is a problem-solving methodology that has four steps (retrieve, reuse, revise, retain) and
benefits from past experiences with high interpretability [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. The CBR methodology is often
used to explain AI models since it concentrates on open-ended, often changing, uncertain, and
incomplete problems. Thus, the concept of XCBR emerged as a sub-field of XAI [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], ofering
lfexible, interpretable, sustainable, and evolving explanation systems using CBR.
      </p>
      <p>This report focuses on post-hoc counterfactual XCBR techniques and identifies areas in
the existing literature that require further investigation while presenting an overview of the
author’s doctoral studies and current state.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Research Objectives</title>
      <p>This section serves as a foundation for outlining the various points of contribution and aims
of my doctoral work. The points that are already published and in progress currently are
elaborated upon in detail in the next section (See Section 3).</p>
      <p>1. Literature review: A comprehensive literature review to establish the theoretical
foundation for the research in XAI and counterfactual explanation generation.
2. Combining global and local explanations: Global explanations help to provide an overall
understanding of how a model is working and can identify important features that are
driving its predictions. This can be particularly useful for identifying biases or areas
where the model could be improved. Local explanations, on the other hand, provide
insight into individual predictions and can help to build trust in the model by giving users
a clear understanding of how the model arrived at a particular decision. Without local
explanations, it can be dificult for users to understand why a particular decision was
made and this may lead to mistrust in the model. By combining both global and local
explanations, machine learning models can be made more transparent, trustworthy, and
ultimately more useful to their intended users.
3. High-quality counterfactuals: Counterfactuals allow hypothetical scenarios to be
generated and evaluated, thus promoting model transparency and interpretability. Moreover,
counterfactuals can be used to test model robustness and evaluate the efect of input
changes on model output. Therefore, the generation of robust, diverse, trustworthy
counterfactuals is essential for the XAI systems that provide counterfactual explanations.
4. Flexible XAI system: Flexibility in XAI systems refers to the ability to adapt in many
aspects like diferent user needs and preferences, data types, amount of the dataset, and
application areas.
5. Domain knowledge integration: Domain knowledge refers to the knowledge and expertise
that is specific to a particular application domain and is often held by domain experts such
as clinicians, engineers, or financial analysts. Incorporation of expert knowledge from a
particular domain into explanation systems is expected to improve their performance,
relevance, and interpretability.
6. Explanation representation: Explanation representation is a critical component of XAI
systems, as it enables users to understand and trust the decisions made by these models.
In instance-based explanations, the explanations can be presented as instances, texts,
tables, graphics in diferent forms, or diferent combinations of them.
7. Evaluation: The evaluation of XAI systems can be done in two ways: user evaluations,
which measure the efect on users, and quantitative evaluations, which rely on statistical
calculations. An ideal XAI system is able to evaluate the generated explanations using
both methods and learn from the outcomes.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology and Progress To Date</title>
      <p>In the previous section, the research objectives and points that we aimed to contribute are listed
and explained. This section presents the methodology for contributing to some of the listed
objectives to date.</p>
      <p>In the initial stages of the research, a thorough literature review was undertaken, which has
been continuously updated and expanded throughout the course of the doctoral studies. The
primary contribution lies in the provision of a comprehensive and in-depth analysis of the
state-of-the-art approaches in the field. This review encompasses a wide range of perspectives
and characteristics, ofering valuable insights into the diverse landscape of research in the
domain. The final version of the literature review will be published until completion of the
doctoral studies, ensuring its availability to the academic community and further enriching the
existing body of knowledge.</p>
      <p>
        The first published work[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] introduces a novel approach to construct an XCBR system that
ofers counterfactual explanations when required. To generate explanations when it is necessary,
an adaptive explanation area is calculated using a sample-centric approach. For each data sample
(), the mean of the  nearest neighbors distance to  is calculated as radius. If there exists
at least one counterfactual within the circle with the calculated radius, the circle is marked
as an explanation area, and the identified explanation pairs are added to the case-base. When
a new query falls within an explanation area, at least one explanation case is activated from
the constructed CBR system, resulting in the creation of a two-phase explanation using a text
template and a bi-directional bar graph (i.e. Figure 2). The proposed system is a flexible system
and has contributions about explanation representation by providing multiple explanation pairs
similar to the query and combining textual explanations which are powerful to convey statistical
data and visual explanations which are powerful to convey comparative data. The proposed
XCBR system is notable for its flexibility with the amount of data and application area, allowing
for multiple explanation pairs that resemble the query, and its contributions to explanation
representation by combining textual and visual explanations.
      </p>
      <p>
        In another sub-project, we proposed a novel approach for generating twin XAI systems that
utilize CBR to explain black-box models in multi-class classification tasks. The preliminary
work has been presented at the XCBR challenge during the 2022 International Conference on
Case-Based Reasoning (ICCBR-2022), and details of the preliminary experiments can be found
in the proceedings [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. However, the extended version is under review.
      </p>
      <p>
        The twin XAI system consists of a multi-agent CBR system (MA-CBR system), where each
agent is developed for a specific class and is modeled separately. The system incorporates
feature attributions and data distribution to project the diferent characteristics of classes
through separately calculated SHAP values for each class over the black-box model. To develop
the local similarity functions, a data-driven similarity measure development method is employed
[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. In this approach, Verma et al. proposed an Inter Quartile Range-based polynomial modeling.
For both global and local similarity function developments, expert knowledge (if available) may
be incorporated.
      </p>
      <p>One of the key contributions of this work is the facilitation of expert knowledge incorporation
into the XAI system, which enhances the reliability and trustworthiness of the explanations
provided. Additionally, the multi-agent structure enables the generation of instance-based
explanations that incorporate both local and global features, providing a comprehensive
understanding of model outputs. An evaluation metric is also introduced called "rigidity" which
measures the adaptability and flexibility of the black-box model’s performance through the
proposed explanation system. This metric helps assess the quality and reliability of the system’s
explanations. The proposed system was tested on diverse datasets with varying characteristics,
diferent performance levels of black box models, and varying degrees of expert knowledge. It
was observed that the system exhibited a high degree of flexibility. Furthermore, reproducible
benchmarking experiments and open-source implementation of the approach and evaluation
metric are provided 1, promoting transparency and further research in the field.</p>
      <p>We are currently engaged in ongoing research focused on the development of a
perturbationbased counterfactual generation method, PertCF, that leverages feature attributions generated
by SHAP values. This approach combines the strengths of perturbation-based counterfactual
generation and feature attribution to produce counterfactuals that are of high quality, stable,
and interpretable. Unlike conventional approaches that employ predefined distance metrics
such as Euclidean distance, PertCF adopts specialized metrics tailored to the specific problem at
hand. This specialization of distance metrics ofers two distinct advantages. Firstly, it utilizes
SHAP values calculated for each class individually, enabling the projection of diferent class
characteristics through feature attribution, in a similar way to the previous work. Secondly, it
facilitates the seamless incorporation of domain or expert knowledge, thereby efectively
representing the semantics of the data. Preliminary evaluations indicate that PertCF demonstrates
measurable advancements over state-of-the-art methods. However, further development and
refinement of the results are necessary to enhance its performance and eficacy.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion and Future Work</title>
      <p>Currently, there are several ongoing tasks and next steps in the research:
• Further development and enhancement of the local-global attribution method to improve
its efectiveness. Specifically, exploring data-driven techniques that are independent of
the model to strengthen its capabilities.
• Refinement and improvement of the counterfactual generation method that is being
worked on, followed by publication to share the findings with the research community.
• Completion of the survey, which aims to provide a comprehensive overview of the
approaches developed in recent years. This involves evaluating and comparing these
approaches based on various characteristics and presenting them from diferent
perspectives.
• Expanding the applicability of the research, such as exploring the integration of
multimodal data to enhance the capabilities and scope of the proposed methods.
• Addressing the challenges related to interactable and customized explanations, seeking
solutions that can efectively handle complex scenarios and accommodate specific user
requirements.</p>
      <p>These tasks collectively aim to advance the understanding and application of explainable
artificial intelligence, improving the interpretability and trustworthiness of machine learning
models.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Tsirtsis</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Gomez Rodriguez, Decisions, counterfactual explanations and strategic behavior</article-title>
          ,
          <source>Advances in Neural Information Processing Systems</source>
          <volume>33</volume>
          (
          <year>2020</year>
          )
          <fpage>16749</fpage>
          -
          <lpage>16760</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Shang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K. K.</given-names>
            <surname>Feng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Shah</surname>
          </string-name>
          ,
          <article-title>Why am I not seeing it? understanding users' needs for counterfactual explanations in everyday recommendations</article-title>
          ,
          <source>in: 2022 ACM Conference on Fairness, Accountability, and Transparency</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>1330</fpage>
          -
          <lpage>1340</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>X.</given-names>
            <surname>Dai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Keane</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Shalloo</surname>
          </string-name>
          , E. Ruelle,
          <string-name>
            <given-names>R. M.</given-names>
            <surname>Byrne</surname>
          </string-name>
          ,
          <article-title>Counterfactual explanations for prediction and diagnosis in xai</article-title>
          ,
          <source>in: Proceedings of the 2022 AAAI/ACM Conference on AI, Ethics, and Society</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>215</fpage>
          -
          <lpage>226</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>I.</given-names>
            <surname>Nunes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Jannach</surname>
          </string-name>
          ,
          <article-title>A systematic review and taxonomy of explanations in decision support and recommender systems, User Modeling and User-Adapted Interaction 27 (</article-title>
          <year>2017</year>
          )
          <fpage>393</fpage>
          -
          <lpage>444</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A. B.</given-names>
            <surname>Arrieta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Díaz-Rodríguez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. Del</given-names>
            <surname>Ser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bennetot</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Tabik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Barbado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>García</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gil-López</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Molina</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Benjamins</surname>
          </string-name>
          , et al.,
          <article-title>Explainable artificial intelligence (xai): Concepts, taxonomies, opportunities and challenges toward responsible ai</article-title>
          ,
          <source>Information fusion 58</source>
          (
          <year>2020</year>
          )
          <fpage>82</fpage>
          -
          <lpage>115</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>A.</given-names>
            <surname>Aamodt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Plaza</surname>
          </string-name>
          ,
          <article-title>Case-based reasoning: Foundational issues, methodological variations, and system approaches</article-title>
          ,
          <source>AI</source>
          communications
          <volume>7</volume>
          (
          <year>1994</year>
          )
          <fpage>39</fpage>
          -
          <lpage>59</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Schoenborn</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. O.</given-names>
            <surname>Weber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. W.</given-names>
            <surname>Aha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Cassens</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.-D. Althof</surname>
          </string-name>
          ,
          <article-title>Explainable case-based reasoning: a survey</article-title>
          ,
          <source>in: AAAI-21 Workshop Proceedings</source>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B.</given-names>
            <surname>Bayrak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Bach</surname>
          </string-name>
          , When to Explain?
          <article-title>Model Agnostic Explanation Using a Case-based Approach and Counterfactuals</article-title>
          , in: A.
          <string-name>
            <surname>Rutle</surname>
          </string-name>
          (Ed.),
          <source>Norsk IKT-konferanse for forskning og utdanning, 1</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>B.</given-names>
            <surname>Bayrak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Marin Veites</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Bach</surname>
          </string-name>
          ,
          <article-title>Explaining your neighbourhood: A CBR approach for explaining black-box models (</article-title>
          <year>2022</year>
          )
          <fpage>251</fpage>
          -
          <lpage>255</lpage>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>994</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>D.</given-names>
            <surname>Verma</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Bach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. J.</given-names>
            <surname>Mork</surname>
          </string-name>
          ,
          <article-title>Modelling similarity for comparing physical activity profilesa data-driven approach</article-title>
          ,
          <source>in: International Conference on Case-Based Reasoning</source>
          , Springer,
          <year>2018</year>
          , pp.
          <fpage>415</fpage>
          -
          <lpage>430</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>