# Explainable Artificial Intelligence for State of Charge Estimation of Lithium-Ion Batteries
## 4 Experiments and Results
### E1: SoC Estimation Using Different NN Architectures
The following hyperparameters were analyzed and tuned; the specifics can be found in Appendix B:
* Dimension of the model--the size of the inputs after the embedding
* Number of attention heads
* Number of encoder layers
* Number of filters in the convolutional layers
* Type of attention used in the encoder; options: \"prob\" or \"full\" The architectures listed above were chosen for the processing of the EV's battery data and SoC estimation because they have been shown in existing works to be capable of processing time series data whilst yielding low prediction errors. As the signals from the BMS are also time series data, it follows that the architectures listed above should be able to utilize the signals and perform estimation of SoC for EV batteries. They are also architectures that have been widely established with many existing implementations; thus, their availability and reproducibility make them suitable for experimentation. The aforementioned NNs were deployed with the following settings:
* **Dataset**: The dataset consists of 269 sessions (265 single-labeled and 4 multi-labeled) recorded for the car model e-Golf. Window segments of 20 min were used as input with a time step interpolation of 1 s and a 30 s stride. The signals used for the NNs were as follows:
* These were selected based on expert opinions and existing knowledge regarding SoC. * **Preprocessing**: Outlier removal and interpolation were applied to the dataset. Using MinMaxScaler, all data, including the labels, were normalised to the range of 0 to 1. **Train, validation, test split**: Stratified session splitting was described in Section 3.4. There were a total of 296 sessions; the train set had 188 sessions, the validation set had 40 sessions, and the test set had 41 sessions. **Training procedures**: Training involved an initial phase of hyperparameter tuning using Optuna [51] with the Tree-Parsing Sampler, while the experiments were subsequently recorded on Neptune.ai [52] as an experiment tracking tool. No oversampling or undersampling techniques were employed for training. The models trained for 1500 epochs with an initial learning rate of 0.0028408 and a batch size of 32, which was scheduled by a cosine scheduler. Early stopping was used with the Adam optimizer, which terminated training after 300 epochs if the loss experienced no changes. This was applied to prevent overfitting. Once the set of hyperparameters and the ideal number of epochs were determined by Optuna, the models were retrained, and their SoC estimations were evaluated based on the metrics in Section 3.6. As previously mentioned, an extensive list of the hyperparameters is available in Appendix B. **Results:** Utilizing the stratified session split method, we trained the different architectures listed for SoC estimation. The results of each architecture with the metrics presented in Section 3.6 are available in Table 4. The results of the metrics inform us that most of the model architectures performed well across the train, validation, and test sets. In particular, LSTM, GRU, and CNN-LSTM achieved MSE values lower than \(5\times 10^{-3}\) and MAE values lower than \(20\times 10^{-3}\) in terms of SoC estimation. The poorer performances (MSE values higher than \(1\times 10^{-3}\) and MAE values higher than \(30\times 10^{-3}\) in terms of SoC estimation) of ResNet, ResNet-LSTM, and InceptionTime suggest that architectures saturated with residual blocks and convolution mechanisms are a poor fit for the signals of EV batteries for SoC estimation. The SoC estimations from CNN-LSTM and GRU can also be confirmed visually in Figures 4a and 5a. Extensive details are given in Figures 11, 12, 13, 14 and 15a, which are available in Appendix A. Additionally, an extended version of Table 4 can also be found in Appendix A's Table 1.  
During the experiment, it was found that the signal CUMULATIVE_DE is prone to misleading the models. This prevents the models from learning how to accurately estimate SoC. Because of this, extra care was taken with CUMULATIVE_DE to minimize this effect.