## 3 Materials and Methods
### Interpretability
#### 3.7.2 STE Discovers the Feature Weights  
As an introductory and illustrative synthesis, we can say that our STE analysis implements and validates a linear surrogate model, which validly approximates the behavior of complex black-box models for each of the samples under study. Accordingly, the weights of the aforementioned linear model could be considered as the summarized contributions of the complex and black-box model under evaluation, for each individually assessed instance.  
Bearing this underlying global rationale in mind, we can describe the detailed process followed in the implementation. We start by using the selected and filtered features previously described earlier using the IVI algorithm and the MIFF filter. We implement the encoder by applying a fine-tuning technique that better encapsulates the relevant information of the input space in a 3D latent space. Once this encoder is built, a variational autoencoder will allow us to generate new surrogate and viable input samples compatible with the existing reality. Then, by using the realistic projected samples that are close enough according to a certain score distance in the latent space, a linear regression model is implemented. This linear model will be considered as the surrogate model that best matches the complex black-box model (an autoencoder model in our case) for such set of samples. Therefore, the weights of such linear model can be quantitatively used as the local single instance contribution of the aforementioned black-box model. The detailed process being followed is described in Algorithm 2, where a VAE is fitted to obtain random samples in the latent space around the transaction that we want to interpret. With these samples, we will calculate the score difference in the latent space with respect to the transaction that we want to interpret using a classifier. These score differences in the latent space are used to obtain weightings to each of the input features in the decision process by means of a linear model.  
```
0: Training set in real space is \(\mathbf{X}\), \(\mathbf{I}_{n}\) is the transaction to interpret, encoder enc, number of resamples \(d\), and number of bootstraps resamples \(s\).
1: Split the set \(\mathbf{X}\) into two subsets, \(\mathbf{X}_{train}\) with \(\mathbf{Y}_{train}\) and \(\mathbf{X}_{test_{i}}\) with \(\mathbf{Y}_{test_{i}}\), and number of bootstraps resamples \(s\).
2: Initialize the \(VAE=\{\}\).
3: Fit VAE. \(VAE\leftarrow VAE.fit(\mathbf{X}_{train})\).
4: Generate realistic synthetic data. \(X^{\prime}\leftarrow VAE.predict(\mathbf{X}_{test})\).
5: Execute encoder to obtain the position in the latent space for instance \(\mathbf{I}_{n}\). \(In_{LS}=enc.predict(\mathbf{I}_{n})\).
6: Execute encoder to obtain the position in the latent space for \(\mathbf{X}_{train}\). \(X_{train_{i}}=enc.predict(\mathbf{X}_{train})\).
7: Fit a classification model in the latent space \(CM\). \(CM\leftarrow CM.fit(\mathbf{X}_{train_{LS}},\mathbf{Y}_{train})\).
8: Execute encoder to obtain the position in the latent space for realistic synthetic data \(X^{\prime}\). \(Sin_{LS_{i}}=enc.predict(\mathbf{X}^{\prime}_{i})\) with \(i=1,\ldots,d\).
9: Calculate score variation in the latent space. \(Y_{score_{i}}=(CM.score(Sin_{LS_{i}})-CM.score(In_{LS}))\) with \(i=1,\ldots,d\).
10:for\(b\gets 1\) to \(s\)do
11: Generate a random subset of realistic synthetic data in real space with size \(N_{b}\), and its distance in score to the Instance to interpret in in the latent space. \(\mathbf{X}_{B}=\mathbf{X}^{\prime}_{k}\), with \(k=1,\ldots,N_{b}\). \(\mathbf{Y}_{B}=\mathbf{Y}_{score_{k}}\), with \(k=1,\ldots,N_{b}\).
12: Fit linear model. \(Mod\leftarrow LinearModel.fit(\mathbf{X}_{B},\mathbf{Y}_{B})\).
13: Obtain the weight vector \(W^{*}_{(b)}\) using \(\mathbf{X}_{B}\) and y \(Y_{B}\).
14: Save weight vector \(X^{*}_{(b)}\) in the \(b\)th column of matrix \(W^{*}\).
15:endfor
```  
**Algorithm 2** Interpretability. STE algorithm