# Contextual Background Estimation for Explainable AI in Temperature Prediction
## 3 Results  
Two data sources were utilized for the experiments. The first is the well-known dataset recorded by the Max Planck Institute for Biogeochemistry [55]. This dataset contains 14 features, including temperature, pressure, and humidity, recorded every 10 min at a weather station located at the Max Planck Institute for Biogeochemistry in Jena, Germany. The dataset spans the period from 10 January 2009 to 31 December 2016. The second dataset was provided by the Institute of Meteorology and Water Management (Instytut Meteorologii i Gospodarki Wodnej, IMGW) [56]. This dataset is more recent and includes data from 10 randomly selected meteorological stations across Poland. The identification numbers of these stations are 351180455, 352200375, 353170235, 349190650, 351190469, 352140310, 352150300, 351160424, 353200272, and 354160115. Twelve features, similar to those in the Jena dataset, were selected for model training and analysis. Unlike the Jena dataset, these measurements were recorded at an hourly frequency, covering the period from 1 January 2015 to 31 December 2023. The data gathered from Jena were also pre-processed to resemble an hourly frequency. All the datasets were trained on separate LSTM models. The models use hourly time-series sequences and predict the temperature two hours ahead based on sequences spanning the previous 72 h. Thus, each time-series sequence created for this article consists of 14 features (\(x_{1},\ldots,x_{14}\)) for the Jena dataset or 12 features (\(x_{1},\ldots,x_{12}\)) for the IMGW dataset and 72 time steps (\(t_{1},\ldots,t_{72}\)). Consequently, the dimensions of the sequences are \(\mathbf{M}_{14\times 72}\) or \(\mathbf{M}_{12\times 72}\). It also has to be mentioned that the models were not optimized. It is possible to limit features and time steps without any impact on the accuracy of the model. In other words, features of no importance or minuscule importance were added to the training, as were time steps. This was carried out on purpose. The aim of this article is not to provide efficient ML models, quite the contrary. The aim is to test two novel methods on the imperfect models. Each model used the same hyperparameters, comprising one LSTM layer with 64 units and one dense output layer. The models were trained on standardized data. It is important to note that the predictions of the models are also standardized, as are the Shapley values. Standardization consisted of subtracting the mean value of a given feature from each value and dividing it by the standard deviation of each value. The standardization was applied as a standard procedure, preventing dominance of features with larger values, which is especially required when comparing the importance of features. Additionally, standardization helps to ensure stable learning and faster convergence. It should also prevent exploding gradients or vanishing gradients. The datasets were split into three subsets: 50% for training, 25% for testing, and 25% for evaluation. To make the estimation more realistic, the data were not shuffled before they were split. This was conducted to make sure that the model will be tested and validated on future data and trained on past data, simulating a realistic application. The evaluation results are presented in Table 1. Due to the standardization, metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE) can be used to demonstrate that the accuracy of the models is comparable. Furthermore, \(R^{2}\) clearly indicates that the models achieve very high accuracy on the validation dataset. The performance of the model and the specific machine learning (ML) algorithm are of lesser importance in this article. LSTM is used merely as an example. The methods presented here can be applied to results obtained from different ML algorithms. The primary focus is placed on explanations. The explainability of the models was assessed using the Kernel SHAP method, which was applied indirectly through the timeSHAP library to calculate feature importance.