# Contextual Background Estimation for Explainable AI in Temperature Prediction
## 1 Introduction
### Limits of XAI
#### 1.2.1 Base Value  
The user of the **model**\(f\) can utilize it to make a certain **prediction**\(y_{e}\). Then, if the user wants to understand why the model \(f\) made this particular prediction, _explanation_ is required. To obtain this explanation, one can use a prominent local **XAI method** calledKernel SHAP.This method uses a **base value**\(y_{b}\) to provide explanations by measuring the **distance** between this base value \(y_{b}\) and a given prediction \(y_{e}\) that requires explanation. This process is schematically illustrated in Figure 2. For example, if a model predicts the price of real estate based on five features \(\mathbf{x}=[x_{1},\ldots,x_{5}]\) and provides a prediction of \(f(\mathbf{x})=y_{e}=\) 72,000 USD, Kernel SHAP would generate an explanation as an importance of each feature. It would indicate how much each feature contributed to moving the prediction from \(y_{b}=\) 43,000 USD toward 72,000 USD or away from it. For each feature \(x_{i}\), Kernel SHAP provides Shapley values \(\varphi_{i}\) in the unit of the target. In Figure 2, the Shapley values are equal to \(\varphi_{1}=\) 19,000 USD, \(\varphi_{2}=\) 7000 USD, \(\varphi_{3}=-\)4000 USD, \(\varphi_{4}=-\)5000 USD, and \(\varphi_{5}=\) 10,000 USD for the respective features. It should also be pointed out that the sum of the base value \(y_{b}\) and all the Shapley values \(\varphi\) is equal to the prediction that the user wants to explain \(y_{e}\). \[f(\mathbf{x})=y_{e}=y_{b}+\sum_{i=1}^{i_{max}}\varphi_{i} \tag{2}\]  
In [26], the base value is defined as the _prediction of the model when none of the feature values for the current output are known_. In practice, this base value is typically the mean prediction of the model [52; 53]. The process involves calculating the mean of each feature across the entire dataset (\(\mathbf{x}_{mean}=[\overline{x}_{1},\ldots,\overline{x}_{i_{max}}]\)), and the prediction based on these mean feature values becomes the base value (\(f(\mathbf{x}_{mean})=y_{b}\)). In the case of Figure 2, the base value is calculated as the mean of each feature \(x_{1},\ldots,x_{5}\), which results in a prediction of \(y_{b}=\) 43,000 USD. These mean features are then used to compute the Shapley values for each feature, which explain how the features contribute to moving the base value to the final prediction of \(y_{e}=\) 72,000 USD. As a result, the base value may fall out of the range of the model's known predictions as it is derived from values that might not be part of the dataset used to train or validate the model. The base value is based on mean values. It is also important to note that, in practice, mean values are not calculated over the entire dataset. According to the official SHAP Documentation ([[https://shap.readthedocs.io/en/latest/index.html](https://shap.readthedocs.io/en/latest/index.html)]([https://shap.readthedocs.io/en/latest/index.html](https://shap.readthedocs.io/en/latest/index.html)), accessed on 20 December 2024), the mean is typically calculated using 100 randomly selected samples. However, as shown in [50], this approach can lead to fluctuations in Shapley values, introducing uncertainties into the results. The authors explained their model by repeatedly  
Figure 2: Schematic description of explanation provided by SHAP method. selecting different sets of 100 (or more) random samples to compute the averages for the base value. For each set of 100 samples, they obtained different base values that resulted in different Shapley values that fluctuated around a certain mean value, thereby introducing variability and uncertainty into the explanations. The authors of [51] highlighted that the default base value is not useful in contextualized situations. For example,  
* If a real-estate agent wanted to understand why a model predicted a property price of 40,000 USD instead of the typical 70,000 USD for the district, a base value of 45,000 USD or 30,000 USD would be unhelpful.