\section{Introduction}

Modern-day applications generate staggering amounts of data, and extracting insightful information from this data is a challenging task. Recent advances in machine learning and deep learning promise advancements towards autonomous systems that will perceive, learn, decide, and act without the need for any human intervention. However, one of the most significant drawbacks of current models is their inability to explain their decisions and actions to humans. Recent studies\cite{social_attack, OnepixelFooling, healthcare_attack} have demonstrated that when deep neural networks are subject to adversaries, severe biases are induced in their decision-making process, hindering their prowess in sociological and healthcare-related domains. Unsurprisingly, several government authorities worldwide have mandated the need to provide explanations on predictions to end customers \cite{adadi2018peeking}. These aspects motivate research on explainable AI (XAI), notably feature attribution methods. Recently, several techniques have been proposed in the context of explainable AI. These methods can be classified as being local \cite{LIME, SHAP, ALIME, DLIME, OptiLIME} or global \cite{SHAP}, model agnostic \cite{LIME, SHAP} or model specific \cite{Deeplift}, intrinsic or post-hoc based, perturbation or saliency-based \cite{ALIME}, concept-based or feature-based\citep{adadi2018peeking}, etc.

Post-hoc, perturbation-based techniques like LIME\cite{LIME} and KernelSHAP \cite{SHAP} are some of the most popular methods for providing model agnostic explanations in the locality of a given instance (which we refer to as the \emph{index sample}). By producing weighted perturbations (surrogate data) in the neighborhood of the instance of interest, these techniques employ locally weighted methods to obtain per-feature importance weights. Despite the widespread usage of these techniques, subsequent works have pointed various issues. For instance, LIME leads to inconsistent explanations on a given sample \cite{Indices, BayLIME, DLIME, ALIME, OptiLIME}, hampers its use in safety-critical systems. Although KernelSHAP successfully counters the stability issue, it employs training data for explanations. In addition, its vulnerabilities to adversarial attacks \cite{FoolingLIME} can attract malicious counterfeit explainer attacks. Essentially, carefully crafted prediction models can hide their biases by exploiting the vulnerabilities inherent in the out-of-distribution surrogate datasets generated by these local techniques. 

An insight derived from the literature\cite{XXAI} is that the lack of structure in the sampling process hampers the quality of surrogate data. In the extreme case, the data tends to be out of distribution, leading to information gain towards adversarial unsteady signals, which produce inconsistent explanations across iterations. This issue was addressed using focused sampling strategies \cite{Slack2020ReliablePH}, which smartly select high information samples from the surrogate dataset and use a linear model for explanations. The inductive bias in linear explainer models limits their capacity in guiding the sample selection process. In addition, LIME, KernelSHAP weigh the random samples, introducing additional hyperparameters that are very hard to choose optimally via cross-validation\cite{OptiLIME, BayLIME}. 

In this work, we propose UnRAvEL(Uncertainty driven Robust Active Learning Based Locally Faithful Explanations), which incorporates Active Learning based sampling and Gaussian process regression (GPR) for generating informative surrogate datasets, which can be combined with several simple models for obtaining explanations. Driving inspiration from active learning strategies like uncertainty sampling \cite{UR} and the exploration-exploitation structure of the Bayesian optimization technique UCB (Upper Confidence Bound) \cite{UCBsrinivas2010gaussian}, we propose a novel acquisition function called \textbf{FUR(Faithful Uncertainty Reduction)}. UnRAvEL intertwines sampling with GPR, which leads to a greedy trade-off between local fidelity via FUR and information gain via GPR. This is illustrated in Fig.~\ref{fig:alpha_comparison_plot_intro}, where it can be seen that at a later iteration, FUR greedily samples close to the index sample, whereas UR and UCB do not show any affinity to the index sample. UnRAvEL interprets locality in a probabilistic sense, and sampling a surrogate dataset is based on the posterior density obtained from GPR. After obtaining the surrogate dataset, different approaches are considered for getting feature importance scores. An ARD explainer \citep{ARDpaananen} is employed for probabilistic explanations using the inverse length parameters of the covariance function, while UnRAvEL-LIME is proposed where a sparse linear model obtains the feature importance weights. We theoretically analyze FUR, which we consider a local optimizer, and explore the regret behavior compared to a global optimizer \cite{kim2020local}. A summarized workflow of UnRAvEL is depicted in Fig.~\ref{fig:main_workflow}.

We demonstrate the performance of UnRAvEL on several real-world classification and regression datasets. We show that UnRAvEL outperforms the benchmarks such as LIME and BayLIME in terms of stability, measured using the Jaccard distance. We also show that faithful explanations using the surrogate dataset in UnRAvEL are achieved using small number of surrogate data samples. We demonstrate the performance of UnRAvEL at low sample efficiency and compare its performance with LIME. Specifically, we consider the  Imagenet\citep{imagenet} dataset and the pre-trained ResNet-18\citep{resnet} model and compare its explanations with LIME and the popular image-based feature/importance attribution technique known as  GradCAM \cite{GradCAM}.

\begin{figure*}
    \centering
     \includegraphics[width=0.9\textwidth]{figures/Workflow_v3.png}
    \caption{Workflow of UnRAvEL: Using the index sample (in red), the active learning module maximizes $\alpha(\mathbf{x}|\mathcal{D}_n)$ to  generate the surrogate dataset $\mathcal{D}_n$. The importance scores can be obtained directly from the kernel function of the GPR (ARD-explainer) or by using a linear explainer on the surrogate data (UnRAvEL-LIME). }
    \label{fig:main_workflow}
\end{figure*}

\section{Novelty and significance}

In this work, we are interested in perturbation-based model-agnostic post-hoc locally interpretable models. Among the well-known methods, LIME \citep{LIME} is one of the earliest popular approaches. We discuss the related works by highlighting the critical aspects of these works and discussing the impact of these aspects.\\
\textbf{Instability}: Several works have reported issues in LIME such as instability or inconsistency in the  explanations over several iterations \citep{DLIME,ALIME}. It is well-accepted that this inconsistency occurs due to random perturbation-based surrogate datasets. A deterministic hierarchical clustering approach for consistent explanations was proposed in DLIME\citep{DLIME}. DLIME requires the training data for clustering. Furthermore, the unequal distribution of points across clusters affected the fidelity of explanations. To avoid the additional task of 'explaining the explainer,' methods like ALIME\citep{ALIME,SmartSamplingGAN} to reduce instability are not preferred. A slight improvement to LIME is the parametric Bayesian method as proposed by \cite{BayLIME}, where a weighted sum of the prior knowledge and the estimates based on new samples obtained from LIME is used to get explanations in a Bayesian linear regression framework. Both LIME and BayLIME employ hyperparameters (kernel-width) that need to be tuned for sampling. In \cite{OptiLIME}, there is the freedom to choose the best adherence-stability trade-off level allowing the practitioner to decide whether the explanation is reliable, necessitating manual intervention. Recently, \cite{Slack2020ReliablePH} proposed a technique known as focused sampling, which utilizes uncertainty estimates to query the black box. \\
\textbf{Bayesian Methods and Uncertainty:} Few recent works have adopted a Bayesian formulation to explain black-box models. In \cite{guo2018explaining}, a Bayesian non-parametric approach was introduced to fit a global Dirichlet mixture across instances. BayLIME \cite{BayLIME} incorporates informative priors to improve the stability of the resulting explanations. In \cite{Slack2020ReliablePH}, the authors focus on modeling the uncertainty of local explanations to sample better from a randomly sampled dataset. In contrast, FUR sequentially selects every sample in the surrogate dataset based on the information gain. To maintain local fidelity, the notion of locality is incorporated into the acquisition function directly. Hence, there is no need for additional processing based on the kernel width. \\
\textbf{Adversarial Robustness:} Recent literature \cite{FoolingLIME, Fooling_geometry} has shown the danger of carefully crafted adversarial classifiers that target the out of distribution surrogate data to hide the inherent biases present in their decision-making process. The assumption is that the attacker can recreate the surrogate data and over-fit these samples to unbiased targets. As demonstrated in \cite{FoolingLIME}, perturbations methods like LIME and KernelSHAP are prone to such attacks because of their perturbation-driven data sampling routine. Moreover, authors in \cite{XXAI} have also theorized that the surrogate data generation pipeline by SHAP and LIME, though simplistic, is not interpretable because of the distance scaling process. To counter that, we motivate a need for a new sampling procedure that is information-theoretic driven and incorporates a distance calculating strategy that is both interpretable and free of hyperparameters.\\
\textbf{Sample Complexity:} Sample efficiency in post-hoc models is a crucial factor in efficiently obtaining reliable explanations, and there is consensus in the community that explainable models must use as few samples for an explanation as possible \cite{Slack2020ReliablePH}. Approaches such as LIME, KernelSHAP, and BayLIME do not provide any guidance on choosing the number of perturbations, although this issue has been acknowledged \cite{BayLIME}. Using FUR, we provide a framework that converges and ceases sampling as the information gain increases and the surrogate samples get closer to the index sample.

\section{Background and Notation}
LIME, KernelSHAP, BayLIME, and BayesSHAP/BayesLIME \citep{Slack2020ReliablePH} are among the popular model-agnostic, local explanation approaches designed to explain any black-box ML model. These methods explain individual predictions of any classifier/regressor in an interpretable manner by learning an easy-to-interpret ML model locally around each prediction. Each of these methods estimates feature attributions on individual instances, which capture the contribution of each feature on the black box prediction.

Let the sample to be explained be $\mathbf{x}_0$, which we refer to as the \emph{index sample}. Let $f_p$ denote the black-box model that takes a data point $\mathbf{x}_i$ as input and returns a target, i.e., $y_i = f_p(\mathbf{x}_i)$. The goal of local post-hoc  model-agnostic methods is to explain $f_p$ in an interpretable and faithful manner without assuming any knowledge about the internal workings of $f_p$. We build an explainer model $f_e(\cdot)$ which employs a surrogate dataset to obtain feature attributions. LIME and KernelSHAP employ sparse linear models, while BayLIME and BayesLIME/BayesSHAP employ Bayesian linear modeling for explaining the black-box model. Mathematically, LIME and KernelSHAP consider a class of models $\mathcal{G}$, and a locally weighted square loss $L(\cdot)$, such that
\begin{align}
    L(f_p,f_e,\pi_{\mathbf{x}}) = \sum_{\mathbf{x}_0,\mathbf{x} \in \mathcal{X}} \pi_{\mathbf{x}}(\mathbf{x}_0)(f_p(\mathbf{x}_0) - f_e(\mathbf{x}))^2,
    \label{eq:basicLIME}
\end{align}
 where $f_e(\cdot) \in \mathcal{G}$, $\mathbf{x}_0$ is the index sample, and $\mathbf{x} \in \mathbb{R}^d$ is the perturbed sample in the original or sparse representation. LIME and KernelSHAP use different strategies to choose $\pi_{\mathbf{x}}(\mathbf{x}_0)$. The generative process in BayLIME and BayesLIME/BayesSHAP corresponds to the Bayesian version of the weighted least squares formulation of LIME and KernelSHAP given in \eqref{eq:basicLIME}. In particular, BayesLIME/BayesSHAP utilizes the uncertainty associated with the feature importance and an error term for driving focused sampling. 

 
\section{Active learning for XAI}

In the context of post-hoc explainable models, we consider an active learning strategy where an active learner has three components: $(f_e, \alpha, \mathcal{X})$. Here, $f_e$ is the explainer model initially trained on the index sample $(\mathbf{x}_0,f_p(\mathbf{x}_0)) \in \mathcal{D}$, $\alpha(\cdot)$ is the querying function that, given a current labeled set $\mathcal{D}$, decides which instance to query next. The post-hoc XAI based active learner returns an explainer model $f_e$ after a fixed number of queries.

\subsection{Gaussian Process (GP) Surrogate Model}
\label{sec:GPDetails}
We employ a Gaussian process-based surrogate model for locally emulating the black-box prediction model. GP has vital advantages over commonly used linear methods in post-hoc XAI, including the ability to fit highly nonlinear functions with minimal risk of over-fitting and capability for uncertainty estimation and quantification \cite{GPRasmussen}. In particular, it \cite{NealGP} shows that the neural networks with infinite hidden units converge to a GP. Gaussian process regression uses a prior distribution on $f_e(\cdot)$ that captures our beliefs about the behavior of $f_p(\cdot)$, and updates this prior with sequentially acquired data $\mathbf{x}$ using an active learning-based acquisition function $\alpha(\cdot)$. Surrogate data leads to a likelihood function $p(\mathcal{D}|f_e)$, which is combined with the prior to obtain the posterior distribution, which in turn is the new prior distribution incorporating both our prior beliefs and information from the surrogate data points. 

We model the prior probability distribution of $f_{e}$ using a Gaussian process prior with zero mean and covariance matrix $\mathbf{K}_0$, i.e., $p(f_{e}) = \textnormal{GP}(f_{e}; \mathbf{0}, \mathbf{K}_0)$, which is a favored process prior due to the closed-form nature of posterior density. Conventionally, for $n$ samples, the $(p,q)$-the entry of a covariance matrix is given by  $k(\mathbf{x}_p,\mathbf{x}_q)$, where $k(\cdot,\cdot)$ is the covariance function. Let the $n$-th ($n < N$) target be $y_n = f_p(\mathbf{x}_n)$, and, $\mathbf{y} = [y_1, y_2,\hdots , y_n]$. The predictive distribution of $y_{n+1}$ conditioned on $\mathbf{x}_{n+1}$ is computed as:
\begin{equation}
    p(y_{n+1}|\mathbf{x}_{n+1}, \mathcal{D}_n) = \mathcal{N}(\mu_n(\mathbf{x}_{n+1}), \sigma_n^2(\mathbf{x}_{n+1})),
\end{equation}
where $\mathcal{D}_n \subset \mathcal{D}$ ,posterior mean is given as $\mu_n(\mathbf{x}) = k_n^T(\mathbf{x})\mathbf{K}_0^{-1}\mathbf{y}_n$ and the posterior  variance $\sigma_n^2(\cdot)$ is given by  $\sigma_n^2(\mathbf{x}) = k(\mathbf{x},\mathbf{x}) - k_n^T(\mathbf{x})\mathbf{K}_0^{-1} k_n^T(\mathbf{x})$, where  $k_n(\mathbf{x}) =  [k(\mathbf{x}, \mathbf{x}_1), \hdots , k(\mathbf{x}, \mathbf{x}_n)]$. The choice of the covariance function $k(\cdot,\cdot)$ is crucial, especially in the context of explainable AI as it encodes the inductive bias of the GP. In particular, covariance functions must be able to capture the information about the structure of the underlying black-box function. The proposed framework is capable of incorporating any covariance function.  We choose the well-known Matern kernels and a linear kernel for illustrating the results. 

\begin{figure*}
    \centering
    \begin{subfigure}[t]{\linewidth}
    \centering    \includegraphics[width=1\textwidth]{figures/alpha_comparison/Introduction_UCB.png}
        \caption{UCB(Upper confidence bound): $\argmax_{\mathbf{x}} \alpha(\mathbf{x}|\mathcal{D}_{n}) = \argmax_{\mathbf{x}} {\mathbf{x} + k\sigma_n(\mathbf{x})}$}
  \end{subfigure}
    \begin{subfigure}[t]{\linewidth}
    \centering    \includegraphics[width=1\textwidth]{figures/alpha_comparison/Introduction_UR.png}
    \caption{Uncertainty Reduction: $\argmax_{\mathbf{x}} \alpha(\mathbf{x}|\mathcal{D}_{n}) = 
    \argmax_{\mathbf{x}} \sigma_n(\mathbf{x})$}
  \end{subfigure}
  \begin{subfigure}[t]{\linewidth}
    \centering    \includegraphics[width=1\textwidth]{figures/alpha_comparison/Introduction_FUR.png}
    \caption{Faithful Uncertainty Reduction: $\argmax_{\mathbf{x}} \alpha(\mathbf{x}|\mathcal{D}_{n}) = 
    \argmax_{\mathbf{x}} -\left\Vert\left(\mathbf{x} - \mathbf{x}_0 - \frac{\overline{\sigma}\epsilon}{\log(n)}\rm\right) \right\Vert_2 + \sigma_n(\mathbf{x})$}
  \end{subfigure}
    \caption{Optimizing the one-dimensional Forrester function\cite{forrester}: Comparison of different iterations of UCB, UR and the proposed FUR acquisition functions}
    \label{fig:alpha_iteration}
    
\end{figure*}
\subsection{Acquisition Functions}

The big question in post-hoc explainable AI is, \emph{Given the instance to be explained, how do we choose the surrogate data samples?}. Active learning acquisition functions provide a principled answer to this question by determining the sampling regions while balancing exploration and exploitation trade-offs. Maximizing an acquisition function $\alpha(\mathbf{x}|\mathcal{D}_n)$ yields the selection of the next point at which to evaluate the objective function, i.e.,
\begin{equation}
    \mathbf{x}_{n} = \argmax_{\mathbf{x}} \alpha(\mathbf{x}|\mathcal{D}_{n-1}).
\end{equation}

Typically, the acquisition function is designed to be an  inexpensive function that can be easily evaluated at a given point. In the context of GP regression, the prior is Gaussian, and the pairwise kernel function specifies the similarity measure between an unobserved point compared to each of the observed points. The posterior is obtained in closed form using the prior likelihood and the kernel function. The mean  $\mu(\mathbf{x})$ and the standard deviation $\sigma(\mathbf{x})$ function forms the basis for designing popular acquisition functions \citep{GPRasmussen}. Along these lines, the most popular acquisition functions include \citep{BORef1} expected improvement (EI), lower/upper confidence bound (LCB/UCB), uncertainty reduction (UR), etc.

Consider the UCB  and UR acquisition functions that lead to a new observation being selected as
\begin{align}
     \textnormal{UCB}&: \mathbf{x}_{n} = \argmax_{\mathbf{x}} \mu_{n-1}(\mathbf{x}) + \sqrt{\beta_{n}}\sigma_{n-1}(\mathbf{x})\nonumber\\
     \textnormal{UR}&:\mathbf{x}_{n} = \argmax_{\mathbf{x}} \sigma_{n-1}(\mathbf{x}).
     \label{eq:UCB-UR}
\end{align}
Note that the goal of these acquisition functions is to obtain the best fit GPR based on the points in a pre-defined domain. 

An essential criterion in locally explainable models is local fidelity. Since it is often impossible for a post-hoc  explanation to be globally faithful unless the complete description of the black-box model and the dataset is available, it is expected that post-hoc models are at least locally faithful, i.e., it must modulate the model behavior in the vicinity of the index sample. Note that the acquisition functions in \eqref{eq:UCB-UR} are not directly applicable in the context of locally explainable models since they do not incorporate anything towards local fidelity. To make this intuition concrete, consider the optimization of the one-dimensional Forrester function ($f(x) = (6x-2) \sin(12x-4)$ in the domain $[0,1]$) in Fig. \ref{fig:alpha_iteration}. It can be seen that the points chosen over several iterations do not necessarily lie in the locality of the index sample $\mathbf{x}_0$. In the case of UCB, the acquisition function explores initially but soon turns exploitative and reaches the global optima. However, UR is more exploratory and decreases uncertainty in the entire interval. Hence, it is evident that for any acquisition function to obtain the best possible points in the locality of the index sample, this function must specify the locality. 

In the following Section, we propose a novel acquisition function that fulfills the criterion of local fidelity while providing the advantages that entail GP. 

\section{Proposed Acquisition Function: UnRAvEL}

We propose a novel acquisition function, which we refer to as \emph{Faithful Uncertainty reduction} given as:
\begin{align}
    \mathbf{x}_n = \argmax_{\mathbf{x}} \underbrace{-\left\Vert\left(\mathbf{x} - \mathbf{x}_0 - \frac{\overline{\sigma}\epsilon}{\log(n)}\rm\right) \right\Vert_2}_{\textnormal{T1}} + \underbrace{\sigma_n(\mathbf{x})}_{\textnormal{T2}},
    \label{eq:FUR}
\end{align}
where $\overline{\sigma}$ is the empirical mean of the standard deviation of individual features in training data, $\epsilon \sim \mathcal{N}(0, 1)$, $\mathbf{x}_0$ is the index sample, and $\sigma_n(\mathbf{x}_n)$ is the standard deviation of $f_e$  obtained until the $n$-th sample $\mathbf{x}_n$. The novel acquisition function has the following properties:
\begin{itemize}
    \item \textbf{Local Fidelity-Exploration Trade off}: From \eqref{eq:FUR}, we see that T1 ensures that the sampled point $\mathbf{x}$ is the nearest in the vicinity of the index sample (a hyper-sphere) whose radius is stochastic but  decays with $n$. The term $\frac{\overline{\sigma}\epsilon}{\log(n)}$ gives wiggle room for the choice of $\mathbf{x}$ and allows FUR to explore in the vicinity of $\mathbf{x}_0$. By incorporating $\overline{\sigma}$, we ensure that exploration around $\mathbf{x}_0$ does not diverge. On the other hand, T2 ensures that the sampled point maximizes information gain \cite{UCBsrinivas2010gaussian}. Hence FUR ensures that local fidelity is achieved in the region close to $\mathbf{x}_0$ while ensuring that the acquisition function explores in this vicinity. This nature of FUR, as compared to UCB and UR can be observed in Fig.~\ref{fig:alpha_iteration}. It can be seen for the one-dimensional example that FUR samples in the vicinity of the index-sample.
    \item \textbf{Sample Efficiency}: In T1, the term $\frac{\overline{\sigma}\epsilon}{\log(n)}$ ensures that as $n$ increases, $\mathbf{x}$ goes closer to the index sample. Furthermore, as $n$ increases, the information gain from $\sigma_n(\mathbf{x})$ (T2) decreases and hence, T1 dominates. Consequently, we observe that samples co-incide with $\mathbf{x}_0$ and FUR converges to an explainable ML model defined in the locality of $\mathbf{x}_0$. For the one-dimensional case, this is illustrated in Fig.~\ref{fig:alpha_iteration} at iteration $20$.
    \item \textbf{Surrogate dataset generator}: The proposed acquisition function is used in conjunction with a GP for  obtaining the posterior variance. Hence, UnRAvEL can be viewed as a method for generating the surrogate dataset, which can generate informative samples around the index sample. The surrogate dataset generated with an appropriate kernel can be used with a sparse linear model for obtaining importance scores. 
    \item \textbf{Hyperparameters}: To compensate for the low capacity linear model, LIME and SHAP employ various hyperparameters that are difficult to estimate. The impact of SHAP hyperparameters like K-means center and LIME hyperparameters like kernel-width for weighing local samples have been studied thoroughly in the literature\cite{OptiLIME, XXAI, BayLIME}. To counter this, methods like BayLIME\cite{BayLIME} employ hyperpriors on kernel width, whereas methods like OptiLIME\cite{OptiLIME} introduce a novel hyperparameter-based optimization function. However, none of these techniques are entirely hyperparameter free. In FUR, the structure of the acquisition function allows an interpretable and sample-efficient search process, shaped only by the kernel function where the samples are information-rich and in the vicinity of the sample being explained.
\end{itemize}

\subsection{Importance Scores using UnRAvEL}
GP models are inherently non-parametric, and hence, to measure importance estimates, we rely on the kernel parameters and the posterior distribution. The prominent methods that can be used to obtain importance scores are as follows:\\
    \textbf{ARD Explainer} \citep{ARDpaananen}: This explainer is obtained by using ARD-based kernel function \cite{ARDpaananen}, where the ARD kernel contains an individual length-scale parameter for each input covariate, and the relevance of each covariate is determined by the estimated length-scale value, large (small) values indicate lower (higher) relevance. \\
    \textbf{UnRAvEL-LIME}: In case UnRAvEL is used for surrogate dataset generation, one can use a sparse linear model for explanations. We refer to this as UnRAvEL-LIME as this leads to LIME-like importance scores using a more minor but informative surrogate dataset.
The pseudo-code for UnRAvEL is as given in Algorithm~1.

\begin{algorithm}
 \caption{UnRAvEL: Uncertainty driven Robust Active Learning Based Locally Faithful Explanations}.
 \begin{algorithmic}[1]


 \REQUIRE Black-box model $f_{p}$, Instance $\mathbf{x}_0 \in \mathbb{R}^{d}$, $\bar{\sigma}$, $\bm{\sigma_{\mathcal{D}}}$ = $[\sigma_1, \hdots, \sigma_n]$, Maximum iterations $L$, Acquisition function $\alpha(\cdot)$
 \STATE Initialize $\mathcal{D}$ using $(\mathbf{x}_0, f_{p}(\mathbf{x}_0))$
 \STATE Set exploration domain for $\alpha(\mathbf{x})$: $\mathbf{x} \in [\mathbf{x}- \bm{\sigma_{\mathcal{D}}}, \mathbf{x} + \bm{\sigma_{\mathcal{D}}}]$.\\ \STATE Initialize the GPR and the ARD kernel. \\
  \textbf{Active Learning Routine:}
  \FOR {$l = 1$ to $L$}
  \STATE Obtain $\mathbf{x}_{l+1}$ by optimizing $\alpha(\mathbf{x})$. $\mathcal{D} \leftarrow \mathcal{D} \cup (\mathbf{x}_{l+1},f_p(\mathbf{x}_{l+1})$. 
  \STATE Train the GPR based $f_{e}$ model on $\mathcal{D}$.
  \ENDFOR
  \RETURN Surrogate data $\mathcal{D}$, Importance scores using ARD-explainer or UnRAvEL-LIME.
 \end{algorithmic} 
 \end{algorithm}
 
\subsection{Local Optimizer Viewpoint}
It is common to perform regret-based convergence analysis for GPR in scenarios where the final goal is to find a global optimum of optimization problems \cite{srinivasLCB}. These convergence guarantees are only valid when the global optimizer of the acquisition function is obtained at each round and selected as the following query point. In the context of post-hoc locally explainable models, a local optimizer of the acquisition function is used since searching for the global optimum is not the end goal. Straightforward regret analysis is challenging, and hence, performance analysis based on the behavior of the proposed local optimizer in terms of instantaneous regrets as compared to a global optimizer is explored similarly to \cite{kim2020local}. 

We denote by $\mathbf{x}_{n,g}$ as the optimizer in round $n$, as determined by a global acquisition method $\mathbf{x}_{t,g} = \argmax_{\mathbf{x}}\alpha_g(\mathbf{x}|\mathcal{D}_{n-1})$, where the reference global acquisition function can be $UCB$ or $UR$ whose convergence is well-known \cite{srinivasLCB}. Further, we denote $\mathbf{x}_{n,l}$ as the optimizer (local) of the acquisition function $\alpha_l(\mathbf{x}|\mathcal{D}_{n-1})$ in round $n$. Suppose that $\mathbf{x}^*$ is the true global minimum of the objective function, and $\mathbf{x}_n$ be a maximum of acquisition function in round $n$, determined by either a global or local optimization method. The regret for round $n$ is defined as $r_n = f_e(\mathbf{x}_n) - f_e(\mathbf{x}^*)$. In this context, we define instantaneous regret differences for an local optimizer $\mathbf{x}_{n,l}$ and global optimizer $\mathbf{x}_{n,g}$ as $|r_{n,g} - r_{n,l}|=|f_e(\mathbf{x}_{n,g})-f_e(\mathbf{x}_{n,l})|$. If $f_e$ is Lipshitz continuous and if the search-domain $\mathcal{X}$ is compact, the following theorem holds.

\begin{theorem}
Given $\zeta \in [0, 1)$, $\epsilon_l, \delta_n > 0$, the probability of the regret difference $|r_{n,g} - r_{n,l}|$ for a local optimizer $\mathbf{x}_{n,l}$ in round $t$ fulfils the following: 
\begin{equation}
    \Pr(|r_{n,g} - r_{n,l}|<\epsilon_l) \geq 1 - \zeta,
\end{equation}
where $\zeta = 1- \frac{d^n_{0,g}}{\eta_1} - \frac{(1-\beta_0)\gamma}{\eta_1} - \frac{M}{\eta_2}$, $\gamma = \max_{xi,xj \in \mathcal{X}} ||x_i- x_j||_2$, $\eta_1\eta_2 = \epsilon_l+\delta_n$, $\delta_n = |f_e(\mathbf{x}_{n,g}) - f_e(\mathbf{x}_0)|$, $d^n_{0,g} = \mathbb{E}||\mathbf{x}_0 - \mathbf{x}_{n,g}||_2$ and $\beta_0$ is the probability that the local optimizer co-incides with the index sample.
\end{theorem}
The proof is given in the appendix. Theorem~1 suggests that the regret of a global optimizer defined on $\mathcal{X}$ is comparable to any FUR-like local optimizer as a function of parameters such as $\gamma$, $\beta_0$, $M$ and $d^n_{0,g}$. If the search domain $\mathcal{X}$ is relatively small, then the local and global regret may be close. Further, as $\beta_0$ is close to one as $n$ increases. However, $d^n_{0,g}$ is irrespective of the local optimizer and solely depends upon the global optimization technique chosen. 

\section{Experimental Results}
In this Section, we demonstrate the efficacy of the proposed UnRAvEL framework on publicly-available real-world  datasets concerning attributes like sample efficiency and stability (consistency) in repeated explanations. We employ tabular and image datasets and consider different black-box models for an explanation. To validate the surrogate data generated by UnRAvEL, we motivate the usage of such data in existing explanation pipelines such as \cite{LIME}.

\begin{table}
        \caption{Description of datasets. 'R' denotes regression and 'C' denotes classification task}
  \begin{tabular}{cccccc}
    \toprule
    \textbf{Dataset} & \textbf{Task} &$p$ & {$n_{train}$} & $n_{total}$ & $R^2$ score \\
    \midrule
    \textbf{Parkinson's} & C & 22 & 195 & 175 & 0.80\\
    \textbf{Cancer} & C & 30 & 512 & 569 & 0.98\\
    \textbf{Adult} & C & 14 & 30162 & 45222 &  0.84\\
    \textbf{Bodyfat} & R & 14 & 226 & 252 & 0.99\\
    \textbf{Boston} & R & 13 & 455 & 506 &  0.92\\
    \hline
    \end{tabular}

    \label{tab:dataset_description}
\end{table}
\begin{figure*}
    \centering
    
    \begin{subfigure}[t]{0.22\linewidth}
    \includegraphics[width=0.85\textwidth, height=0.15\textheight]{figures/mip_plots/Adult_MIP_5.png}        \caption{Explaining $f_p(\mathbf{x})=0.91$}
    \end{subfigure}
  \begin{subfigure}[t]{0.22\linewidth}
    \centering    \includegraphics[width=0.85\textwidth, height=0.15\textheight]{figures/mip_plots/Adult_MIP_6.png}
    \caption{Explaining $f_p(\mathbf{x})=0.05$}
  \end{subfigure}
  \begin{subfigure}[t]{0.22\linewidth}
    \centering    \includegraphics[width=0.85\textwidth, height=0.15\textheight]{figures/mip_plots/Boston_MIP_5.png}
    \caption{Explaining $f_p(\mathbf{x})=35.73$}
  \end{subfigure}
  \begin{subfigure}[t]{0.22\linewidth}
    \centering    \includegraphics[width=0.85\textwidth, height=0.15\textheight]{figures/mip_plots/Boston_MIP_8.png}
    \caption{Explaining $f_p(\mathbf{x})=11.85$}
  \end{subfigure}
  \caption{Mean Importance scores for two samples from the Adult dataset(a-b) and Boston house pricing dataset(c-d). Both the datasets have sensitive variables in their setup.}
    \label{fig:mip_comparison}
\end{figure*}

\subsection{Datasets and Pre-processing}

We chose five distinct datasets from the UCI Machine Learning repository \cite{UCI} for the tabular data-based experiments based on their usage in the relevant literature \cite{BayLIME,DLIME,ALIME}, feature novelty, and prediction task. The employed pre-processing pipeline was the same for all the datasets, involving removing all missing values, frequency encoding of categorical features, followed by a standardization procedure per feature. The description of the datasets are as follows: 
\begin{itemize}
    \item Parkinson's: The Parkinson's classification dataset consists of $195$ biomedical recordings of patients suffering and free from Parkinson's disease. With $22$ unique features per recording, the task is to classify whether a given patient has Parkinson's or not.
    
    \item Cancer: The Breast cancer classification dataset consists of $569$ entries, with $30$ features computed from an image of a breast mass, describing characteristics of the cell nuclei present in the image to predict if the cancer is malignant or not. 
    
    \item Adult: The Adult Income classification dataset consists of $14$ features describing the educational, financial, and racial recordings of $45222$ adult individuals. The task is to predict whether the income of a given individual is above $50,000$ US Dollars or not.
    
    \item Boston: The Boston house pricing regression dataset consists of $506$ entries with $13$ features of homes from various suburbs located in Boston. The task is to predict the price of the house based on neighborhood features.
    
    \item Bodyfat: The Bodyfat regression dataset consists of $14$ features, each depicting various physical properties like determining the body fat percentage of $252$ men.
    
\end{itemize}
For simulating the prediction models, we used a Support Vector Classifier for all the classification datasets and an Extra Trees Regressor for all the regression datasets based on their accuracy performance on the test set. A summary of the dataset and prediction model statistics can be found in Table \ref{tab:dataset_description}.

\begin{figure}
    \centering
    \begin{subfigure}[t]{0.45\linewidth}
    \includegraphics[width=1.05\textwidth]{figures/surrogate_data_comparison/Adult_sample_3.png}
        \caption{$f_p(\mathbf{x})=0.52$}
    \end{subfigure}
  \begin{subfigure}[t]{0.45\linewidth}
    \centering    \includegraphics[width=1.05\textwidth]{figures/surrogate_data_comparison/Adult_sample_9.png}
    \caption{$f_p(\mathbf{x})=0.78$}
  \end{subfigure}
    \caption{Comparison of the explanations generated by LIME and UnRAvEL-LIME, As can be seen, the explanations generated by UnRAvEL-LIME are less uncertain than their LIME counterpart}.
    \label{fig:surrogate_data_comparison}
\end{figure}


\begin{figure*}
\centering
\begin{tabular}{cc@{\hskip 1cm}c@{\hskip 1cm}cc}
\setlength\tabcolsep{0pt}
 \textbf{Target Image} &
 \textbf{Grad-CAM Output} & 
 \textbf{UnRAvEL(100 samples)} &
 \textbf{LIME(100 samples)} & 
 \textbf{LIME(10,000 samples)}\\
 \includegraphics[width=0.15\textwidth]{figures/images/original_1.png} &
 \includegraphics[width=0.15\textwidth]{figures/images/gradcam_1.png} &
\includegraphics[width=0.15\textwidth]{figures/images/unravel_1.png} &
\includegraphics[width=0.15\textwidth]{figures/images/lime_100_1.png} &
\includegraphics[width=0.15\textwidth]{figures/images/lime_10000_1.png}\\
\footnotesize P('Samoyed') = 0.77&&&&\\
 \includegraphics[width=0.15\textwidth]{figures/images/original_2_actual.png} &
\includegraphics[width=0.15\textwidth]{figures/images/gradcam_2_actual.png} & \includegraphics[width=0.15\textwidth]{figures/images/unravel_2_actual.png} &
\includegraphics[width=0.15\textwidth]{figures/images/lime_100_2_actual.png} & \includegraphics[width=0.15\textwidth]{figures/images/lime_10000_2_actual.png}\\
\footnotesize P('Accordion') = 0.99&&&&\\
 \includegraphics[width=0.15\textwidth]{figures/images/original_4.png} &
\includegraphics[width=0.15\textwidth]{figures/images/gradcam_4.png} & \includegraphics[width=0.15\textwidth]{figures/images/unravel_4.png}  &
\includegraphics[width=0.15\textwidth]{figures/images/lime_100_4.png} & \includegraphics[width=0.15\textwidth]{figures/images/lime_10000_4.png}\\
\footnotesize P('Electric Guitar') = 0.33&&&&\\
 \includegraphics[width=0.15\textwidth]{figures/images/original_5.png} &
\includegraphics[width=0.15\textwidth]{figures/images/gradcam_5.png} & \includegraphics[width=0.15\textwidth]{figures/images/unravel_5.png}  &
\includegraphics[width=0.15\textwidth]{figures/images/lime_100_6.png} & \includegraphics[width=0.15\textwidth]{figures/images/lime_10000_6.png}\\
\footnotesize P('Bullet Train') = 0.99&&&&\\
\end{tabular}
\caption{Comparisons of image explanation maps for Resnet-18\cite{resnet} using some samples from the Imagenet dataset\cite{imagenet}}
\label{fig:image}
\end{figure*}
\subsection{Experimental Setup}
We used the open-source GPyOpt\cite{gpyopt} library for UnRAvEL and the Scikit-Learn\citep{sklearn} implementation of the Extra Trees Regressor and Support Vector classifier to simulate the black-box prediction models\footnote{Source code available at \url{https://github.com/adityasaini70/UnRAvEL}} . 
\subsubsection{Baselines}
Since UnRAvEL derives only the standard deviation of each feature from the training data, we intend to compare it with methods employing similar assumptions in their workflow. Going through dense literature of XAI methods, we found that very few perturbation-based models agnostic XAI approaches exist, which do not use the training data as part of their workflow. Techniques like DLIME\cite{DLIME} cluster the entire training data while KernelSHAP requires an explicit passing of the training dataset as a background dataset in the sampling process. We use LIME and BayLIME\cite{BayLIME} as our baselines primarily because they take only the initial sample and variance from the training data. Apart from that, a linear kernel accompanied with a GP model is synonymous with doing Bayesian Linear regression; thus, we argue that UnRAvEL-L is a method synonymous with BayLIME. For the image datasets, we used the popular Grad-CAM\cite{GradCAM} tool to give an idea of the gradient-based explanation maps and plotted the explanation maps for LIME at $100$ samples and $10000$ samples.
\begin{table}
    
\caption{Stability metric computed for 10 randomly selected test samples. The bold values depict the most optimum results.}
  \begin{tabular}{cccccc}
    \toprule
    \textbf{Dataset} & \textbf{LIME} & \textbf{BayLIME} &\textbf{UnRAvEL-L} & \textbf{UnRAvEL}\\
    \midrule
    \textbf{Parkinson's} & 0.743& 0.738&0.499&\textbf{0.146}\\
    \textbf{Cancer} &0.826&0.824&0.655&\textbf{0.295}  \\
    \textbf{Adult} &0.520& 0.524&0.402&\textbf{0.288}  \\
    \textbf{Boston} &0.664&0.668&\textbf{0.462}& 0.539  \\
    \textbf{Bodyfat} &0.687&0.693&\textbf{0.503}& 0.701\\ 
    \bottomrule
  \end{tabular}
  \label{tab:stability_experiments}

\end{table}

\subsection{Evaluation criteria}
\subsubsection{Stability in repeated explanations}
For evaluating the inconsistency in explanations over multiple runs, we ran UnRAvEL, UnRAvEL-L, and the baselines using $100$ surrogate samples and collected $50$ consecutive explanations for $10$ randomly selected index samples for each of the five datasets described in Table\ref{tab:dataset_description}. We used the Jaccard's distance(J) score \cite{DLIME} for the explanation in the $i$-th, and $j$-th run can be computed as follows:
    \begin{equation}
        J(X_i,X_j) = 1-\frac{|X_i \cap X_j|}{|X_i \cup X_j|}
    \end{equation}
where $X_i$ and $X_j$ are sets consisting of top-5 features for iterations $i$ and $j$. Intuitively, it can be observed that $J(X_i,X_j)=0$ if $X_i$ and $X_j$ have the same features, and $J(X_i,X_j)=0$ if they have no common features. Thus, a consistent explainer module will have a relatively lower value of this metric than a relatively inconsistent explainer module. We averaged this metric over all possible combinations of iterations and the $10$ index samples. The results are as given in Table~\ref{tab:stability_experiments} where it can be be seen that for the three classification datasets, UnRAvEL outperforms both LIME and BayLIME. Moreover, for both the regression datasets, UnRAvEL-L, i.e., UnRAvEL with a Linear kernel, outperforms the rest. This shows the superior stability performance of UnRAvEL along with increased flexibility to employ any kernel.

We also plot the mean importance score in Fig.~\ref{fig:mip_comparison} as obtained from the ARD explainer for two samples from the Adult and Boston dataset to understand the type of explanations over which the stability score was computed. The plots were averaged over ten consecutive iterations per index sample.

\subsubsection{UnRAvEL Surrogate Data}
For evaluating the quality of the surrogate dataset generated by UnRAvEL, we collected the surrogate data generated during the stability experiment for two samples from the Adult dataset and used the sparse linear explainer for generating the importance scores. The violin plot for all the features can be found in Fig.~\ref{fig:surrogate_data_comparison}. It can be seen that the importance scores generated by UnRAvEL-LIME (UnRAvEL data coupled with sparse linear explainer) have very low uncertainty as compared to the importance scores generated by LIME. This supports our argument regarding the information gain aspect of the  surrogate data generated by UnRAvEL, using which even sparse linear models can compute highly consistent explanations. 

\subsubsection{UnRAvEL on Image Datasets}
To showcase the UnRAvEL's ability in the case of image datasets, we generated the prediction probabilities using a pre-trained ResNet-18 model\citep{resnet} for sample images from the Imagenet dataset\citep{imagenet}. We used a popular segmentation algorithm called Simple Linear Iterative Clustering (SLIC)\citep{slic} to form $50$ segments of every image and generated a corresponding feature space with continuous attributes where each feature depicted the presence of that index component in the original image. We then used the UnRAvEL classification module on this newly generated feature space to generate the importance score. As a baseline, we plotted the output from Grad-CAM and LIME at $100$ and $10000$ samples. The results are as given in Fig.\ref{fig:image}. UnRAvEL at just $100$ samples can produce explanations that are semantically accurate and are consistent with LIME at $10000$ samples and Grad-CAM. This shows that UnRAvEL is an efficient sample method generating compact yet informative surrogate datasets. 

\section{Conclusions and Future Work}
In this work, we proposed UnRAvEL, a novel explainable AI method that employs a novel acquisition function based on Active Learning, followed by a Gaussian process regression model for obtaining locally interpretable, model agnostic explanations. Through experiments, we showed the stability of UnRAvEL as compared to LIME and BayLIME on tabular structured data. Moreover, we showed the capabilities of UnRAvEL as a surrogate data generation module that can be coupled with custom explainer modules as well. We also showed the sample efficiency of UnRAvEL as compared to LIME on the Imagenet dataset. 

To the best of the authors' knowledge, this is the first work that designs a novel information-gain-based acquisition function, FUR (Faithful Uncertainty Reduction), in the context of Explainable AI and paves the way for many such  exciting directions. The acquisition function used in UnRAvEL allows it to ultimately be independent of the explainer module. This observation can be extended to devise a global explanation module of UnRAvEL, which is a part of our future work. As seen from the experiments, the kernel used in the Gaussian Process explainer can be utilized in many domain-specific applications to make UnRAvEL more robust and stable.
\begin{acks}
This work was supported by the DST funded TiH project and I-HUB Anubhuti Chanakya Fellowship Grant.
\end{acks}

\bibliographystyle{ACM-Reference-Format.bst}
