<!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 />
    <article-meta>
      <title-group>
        <article-title>The metric-aware kernel-width choice for LIME</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aurelio Barrera-Vicent</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Eduardo Paluzo-Hidalgo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Miguel A. Gutiérrez-Naranjo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dept. Applied Mathematics I, University of Seville</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Dept. Computer Science and Artificial Intelligence, University of Seville</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Local Interpretable Model-Agnostic Explanations (LIME) are a well-known approach to provide local interpretability to Machine Learning models. LIME uses an exponential smoothing kernel based on the kernel width value, which defines the width of the local neighbourhood. In this paper, we study the influence of the distances for these local explanations, and we explore the choice of kernel width to guarantee a fair performance comparison between the distances.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;XAI</kwd>
        <kwd>LIME</kwd>
        <kwd>Kernel width</kwd>
        <kwd>Explainability</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The gap between the recent development of AI models and their social use has led the scientific
community to develop a new research area called Explainable Artificial Intelligence (XAI)
(see, e.g., [
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5 ref6">1, 2, 3, 4, 5, 6</xref>
        ] for some comprehensive surveys). According to the literature, XAI
must contain a set of techniques to provide clear, intelligible, trustworthy, and interpretable
explanations of the decisions, predictions, and reasoning processes made by AI models. From a
technical point of view, there are many criteria for building a taxonomy of XAI methods [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]:
Model agnostic vs. model specific; intrinsic vs. post hoc; etc. One of them considers whether
the explanation is local or global [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
      <p>
        One of the key points in these local explanations is the meaning of local. In this way, the
sense of proximity among points in the training dataset of the model plays a central role in
local explanations, and hence the choice of the distance considered is crucial in order to find
plausible explanations. In this paper, we consider one of the most widely used XAI methods,
the well-known method LIME [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] and we consider the influence of considering several metrics
on it and how the stability and adherence of the model [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] perform when the dimension of the
dataset grows and study the definition of a fair parameter (the kernel width) for a trustworthy
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Related work</title>
      <p>
        LIME is a XAI model to provide interpretability for individual instances1. Each local explanation
is a set of feature-value pairs that determine which features provide a greater contribution to the
prediction, together with a numeric value that quantifies this contribution. In the literature, we
can find several studies of LIME focussing on diferent improvements on the original algorithm as
[
        <xref ref-type="bibr" rid="ref10 ref11 ref12 ref13 ref14 ref15 ref16">11, 12, 13, 14, 15, 16, 10</xref>
        ]. LIME algorithm tries to maximize the local fidelity of the explanations
approximating the model to be explained  by a simpler model while having a low complexity
(in terms of human readability) of the interpretable model. In LIME, by default the simpler
model is a Ridge linear model. The input of LIME is a model  and an individual data sample
 to be explained. To generate a dataset to train the Ridge linear model, firstly, a interpretable
representation of the dataset is computed. The dataset is then discretized (by default in quartiles)
and samples  around the binary representation of  are drawn weighted by the proximity
measure between an instance  and  in the binary representation. Generally, the proximity
measure is defined as an exponential kernel Π() = (− (, )2/ 2) where  is the kernel
width and  the chosen distance. Let us remark that the kernel width defines the locality of
the model. Finally, a Ridge regression model is trained on the generated perturbed data. To
quantify the stability of the LIME explanations, in [17], the authors proposed the CSI metric,
which measures the similarity between the coeficients in diferent repetitions of the LIME
algorithm. Roughly speaking, for each feature, using a Gaussian distribution of the coeficients,
95% confidence intervals are computed. Then, the intersection of the confidence intervals is
binary encoded and the value is normalized. Finally, the mean of all the values obtained is
computed as a measure of concordance of the specific feature’s coeficients among the diferent
LIME repetitions.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Relation between metrics</title>
      <p>The reliability of the Euclidean distance to capture the intuition of proximity in high-dimensional
metrics spaces has been widely studied. For example, in [18] the authors explain how
using traditional metrics (, ) = ∑︀=1 | − |1/ in high-dimensionality problems leads
to a loss of the notion of proximity. This is a major concern in problems where proximity
plays an important role. LIME uses a metric to measure the distance between binary vectors
whose components are 0’s and 1’s. In this context, the Hamming distance can be expressed as
Hamming(, ) = ∑︀</p>
      <p>=1 | − | which is exactly 1. In the case of binary vectors, the only
diference between applying the Hamming or Euclidean distance is the square root, given that
12 = 1 and 02 = 0. Furthermore, the maximum in the Hamming distance between two binary
sequences in R is , but the maximum distance between two binary sequences in R in the
Euclidean distance is √, as one is the square root of the other. In the LIME implementation, the
default value given to the kernel width is 0.75 · √, which can be seen as 75% of the maximum
1Along this paper, we refer exclusively to explanations of tabular data.
value given by Euclidean distances over an n-dimensional space. Using the same idea, we define
a custom kernel width for the Manhattan distance as 0.75 · . Analogously, a kernel width
comparable to the Euclidean metric performance (using the custom definition) for each  is
given by  = 0.75 · 1/.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Experimentation</title>
      <sec id="sec-4-1">
        <title>4.1. Kernel-width selection towards a fair comparison</title>
        <p>
          In this experiment, we study the appropriate kernel width to be used depending on the metric.
Firstly, diferent synthetic data sets composed of 500 samples of diferent dimensions (from
10 to 40 with a step of 10) were generated. Secondly, for each dimension, a Random Forest
classifier was trained using 90% of the dataset as a training set. Thirdly, LIME was used to
explain the remaining 10% of the data set (used as a test set) using all the attributes available.
The  metric is computed for the coeficient stability [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ]. The last step was computed
for diferent choices of the kernel width. Specifically, for the Euclidean distance, we used the
75% of the maximum possible distance, and for the Manhattan distance, both the 75% of the
maximum possible distance and the 75% of the square root of the maximum possible distance
were applied. In Figure 1, the mean values of the CSI coeficients are provided for the diferent
dimensions.
        </p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Comparison between the two distances</title>
        <p>In this second experiment, we compare the explanations obtained using LIME using both
distances. The explanations provided by LIME are an ordered list of the attributes based on its
contribution. The dataset used is the UCI ML Breast Cancer Wisconsing (Diagnostic) dataset
composed of 569 samples of dimension 30 for binary classification. The dataset was split into
training and test set in a proportion 90 − 10 and a Random Forest classifier was trained. Then,
explanations were computed for the remaining 10%, obtaining a vector of the 30 attributes
ordered by importance. This was done using the predefined kernel width for the Euclidean
distance, and both the predefined and the proposed kernel width for the Hamming distance.
The vectors were compared as follows: Given two vectors ,  with length the number of</p>
        <p>CSI</p>
        <p>Variance
0.1
8.53
0.12
features in the dataset, for each feature we compute the diference between the coordinates
of the feature in  and . Finally, the mean of these diferences is computed. This provides a
similarity measure in the order of importance of the attributes. In Table 1 (left), the coeficients
CSI are shown, depicting the stability reached by LIME using the diferent kernel widths. Let us
remark that the conclusions of Experiment 1 are also achieved. We can see that the high values
are reached for the Euclidean distance using the predefined kernel width and the Manhattan
distance using the proposed one. In Table 1 (right), the similarity measure between the order of
the features computed using LIME is provided. Therefore, it is shown that both distances have
similar performance, providing similar relevance of the same features.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>In the foundations of Machine Learning, it is well-known that the Euclidean distance loses the
proximity notion for high dimensions, while the Hamming distance performs better in that
context. However, this fact is not considered in the standard use of LIME and hence, undesirable
explanations can be obtained. In this paper, we have studied the relationship between the
Euclidean and the Hamming distances in this context, concluding its similarity. Experimentally,
we have shown that the stability of the LIME algorithm converges and that the resultant order
of importance of the features is similar when using the Euclidean and the Hamming distance if
the kernel width is adapted to the chosen distance.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>Partially supported by REXASI-PRO H-EU project, call HORIZON-CL4-2021-HUMAN-01-01,
Grant agreement no. 101070028, and national projects PID2019-107339GB-I00 and
TED2021129438B-I00 funded by MCIN/AEI/ 10.13039/501100011033 and NextGenerationEU/PRTR. The
content reflects the views of the authors only.</p>
      <p>2008.11092.
[17] G. Visani, E. Bagli, F. Chesani, A. Poluzzi, D. Capuzzo, Statistical stability indices for LIME:
Obtaining reliable explanations for machine learning models, Journal of the Operational
Research Society 73 (2021) 91–101. URL: https://doi.org/10.1080%2F01605682.2020.1865846.
doi:10.1080/01605682.2020.1865846.
[18] C. C. Aggarwal, A. Hinneburg, D. A. Keim, On the surprising behavior of distance metrics
in high dimensional space, in: J. Van den Bussche, V. Vianu (Eds.), Database Theory —
ICDT 2001, Springer Berlin Heidelberg, Berlin, Heidelberg, 2001, pp. 420–434.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Adadi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Berrada</surname>
          </string-name>
          ,
          <article-title>Peeking inside the black-box: A survey on explainable artificial intelligence (xai)</article-title>
          ,
          <source>IEEE Access 6</source>
          (
          <year>2018</year>
          )
          <fpage>52138</fpage>
          -
          <lpage>52160</lpage>
          . doi:
          <volume>10</volume>
          .1109/ACCESS.
          <year>2018</year>
          .
          <volume>2870052</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A. B.</given-names>
            <surname>Arrieta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. D.</given-names>
            <surname>Rodríguez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. D.</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>
          , S. GilLopez, D. Molina,
          <string-name>
            <given-names>R.</given-names>
            <surname>Benjamins</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Chatila</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Herrera</surname>
          </string-name>
          ,
          <article-title>Explainable artificial intelligence (XAI): concepts, taxonomies, opportunities and challenges toward responsible AI, Inf</article-title>
          .
          <source>Fusion</source>
          <volume>58</volume>
          (
          <year>2020</year>
          )
          <fpage>82</fpage>
          -
          <lpage>115</lpage>
          . URL: https://doi.org/10.1016/j.infus.
          <year>2019</year>
          .
          <volume>12</volume>
          .012. doi:
          <volume>10</volume>
          .1016/j. inffus.
          <year>2019</year>
          .
          <volume>12</volume>
          .012.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Y.-N.</given-names>
            <surname>Chuang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Cai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Du</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <article-title>Eficient XAI techniques: A taxonomic survey</article-title>
          ,
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.2302.03225.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>R.</given-names>
            <surname>Guidotti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Monreale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ruggieri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Turini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Giannotti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Pedreschi</surname>
          </string-name>
          ,
          <article-title>A survey of methods for explaining black box models</article-title>
          ,
          <source>ACM Comput. Surv</source>
          .
          <volume>51</volume>
          (
          <year>2019</year>
          )
          <volume>93</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>93</lpage>
          :
          <fpage>42</fpage>
          . URL: https://doi.org/10.1145/3236009. doi:
          <volume>10</volume>
          .1145/3236009.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A.</given-names>
            <surname>Jacovi</surname>
          </string-name>
          ,
          <article-title>Trends in explainable AI (XAI) literature</article-title>
          ,
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.2301. 05433.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>W.</given-names>
            <surname>Saeed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Omlin</surname>
          </string-name>
          ,
          <string-name>
            <surname>Explainable</surname>
            <given-names>AI</given-names>
          </string-name>
          (
          <article-title>XAI): A systematic meta-survey of current challenges and future opportunities</article-title>
          ,
          <source>Knowledge-Based Systems</source>
          <volume>263</volume>
          (
          <year>2023</year>
          )
          <article-title>110273</article-title>
          . doi:
          <volume>10</volume>
          .1016/j. knosys.
          <year>2023</year>
          .
          <volume>110273</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>C.</given-names>
            <surname>Molnar</surname>
          </string-name>
          ,
          <source>Interpretable Machine Learning</source>
          ,
          <volume>2</volume>
          <fpage>ed</fpage>
          .,
          <source>Independently published</source>
          ,
          <year>2022</year>
          . URL: https://christophm.github.io/interpretable-ml-book,
          <source>accesed on 2023-04-14.</source>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Du</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <source>Techniques for interpretable machine learning</source>
          ,
          <year>2018</year>
          . doi:
          <volume>10</volume>
          .48550/ ARXIV.
          <year>1808</year>
          .
          <volume>00033</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Ribeiro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Guestrin</surname>
          </string-name>
          ,
          <article-title>"Why should I trust you?": Explaining the predictions of any classifier</article-title>
          ,
          <year>2016</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.1602.04938.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>G.</given-names>
            <surname>Visani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Bagli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Chesani</surname>
          </string-name>
          ,
          <article-title>OptiLIME: Optimized LIME explanations for diagnostic computer algorithms</article-title>
          , CoRR abs/
          <year>2006</year>
          .05714 (
          <year>2020</year>
          ). URL: https://arxiv.org/abs/
          <year>2006</year>
          .05714. arXiv:
          <year>2006</year>
          .05714.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>M. R.</given-names>
            <surname>Zafar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N. M.</given-names>
            <surname>Khan</surname>
          </string-name>
          ,
          <article-title>Dlime: A deterministic local interpretable model-agnostic explanations approach for computer-aided diagnosis systems</article-title>
          ,
          <year>2019</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.
          <year>1906</year>
          .
          <volume>10263</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>S. M.</given-names>
            <surname>Shankaranarayana</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Runje</surname>
          </string-name>
          ,
          <article-title>Alime: Autoencoder based approach for local interpretability</article-title>
          ,
          <year>2019</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.
          <year>1909</year>
          .
          <volume>02437</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>S.</given-names>
            <surname>Shi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Du</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Fan</surname>
          </string-name>
          ,
          <article-title>An extension of lime with improvement of interpretability and ifdelity</article-title>
          ,
          <year>2020</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.
          <year>2004</year>
          .
          <volume>12277</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Mishra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. L.</given-names>
            <surname>Sturm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Dixon</surname>
          </string-name>
          ,
          <article-title>Local interpretable model-agnostic explanations for music content analysis</article-title>
          , in: S. J.
          <string-name>
            <surname>Cunningham</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          <string-name>
            <surname>Duan</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          <string-name>
            <surname>Hu</surname>
          </string-name>
          , D. Turnbull (Eds.),
          <source>Proceedings of the 18th International Society for Music Information Retrieval Conference</source>
          ,
          <string-name>
            <surname>ISMIR</surname>
          </string-name>
          <year>2017</year>
          , Suzhou, China,
          <source>October 23-27</source>
          ,
          <year>2017</year>
          ,
          <year>2017</year>
          , pp.
          <fpage>537</fpage>
          -
          <lpage>543</lpage>
          . URL: https://ismir2017.smcnus.org/ wp-content/uploads/2017/10/216_Paper.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>M. S.</given-names>
            <surname>Kovalev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. V.</given-names>
            <surname>Utkin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. M.</given-names>
            <surname>Kasimov</surname>
          </string-name>
          ,
          <article-title>Survlime: A method for explaining machine learning survival models</article-title>
          ,
          <source>Knowledge-Based Systems</source>
          <volume>203</volume>
          (
          <year>2020</year>
          )
          <article-title>106164</article-title>
          . doi:
          <volume>10</volume>
          .1016/j. knosys.
          <year>2020</year>
          .
          <volume>106164</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>D.</given-names>
            <surname>Garreau</surname>
          </string-name>
          , U. von Luxburg,
          <source>Looking deeper into tabular lime</source>
          ,
          <year>2020</year>
          . doi:
          <volume>10</volume>
          .48550/ARXIV.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>