# Machine Learning-Based Lithium Battery State of Health Prediction Research
## 4 Experimentation and Analysis of Results
### Model Experiment Results
#### 4.2.2 Analysis of Experimental Results for Different Models  
The PSO-LSTM, PSO-CNN, and PSO-SVR models were trained and tested using the parameter values obtained from the PSO described above. The predicted values of the PSO-LSTM, PSO-CNN, and PSO-SVR models on different datasets were then compared with the actual values, as illustrated in Figure 5.  
As shown in the three graphs in Figure 5, the PSO-LSTM, PSO-CNN, and PSO-SVR models all demonstrate good prediction results for the SOH of cells B0005, B0006, and B0007, although there are differences in accuracy. The PSO-LSTM prediction curve is closest to the actual values, especially in most cycles, where it shows better tracking and smaller fluctuations, indicating its significant advantage in capturing the data's changing trends. Even in areas with large fluctuations, PSO-LSTM is relatively accurate in predicting the direction of data changes. The PSO-CNN model generally performs well in prediction, with its predicted values closely following the trend in actual values, particularly in areas where data changes are relatively stable. However, in regions with large data fluctuations, its prediction accuracy decreases, indicating certain limitations when dealing with  
Figure 5: Prediction results of the three models on the three datasets. Among them, the plots in (**a**–**c**) represent the comparison between the predicted values and the true values of the B0005, B0006, and B0007 datasets on the three models, respectively.  
complex patterns and sudden changes. Although the PSO-SVR model smoothly tracks real value changes in most data points, it exhibits more pronounced errors in areas with significant fluctuations, suggesting that while it performs well in capturing global trends, it is somewhat insufficient in regions with large data variations.  
To comprehensively compare the predictive performance of the models, four commonly used evaluation metrics are employed: _RMSE_, _MAE_, _MAPE_, and the Coefficient of \(\text{D}R^{2}\)[36]. The formulas for calculating each metric are as follows:  
\[MAE=\frac{1}{N}{\sum\limits_{i=1}^{N}}{\left|{{{\hat{y}}_{i}}-{{y}_{i}}}\right|} \tag{14}\]  
\[RMSE=\sqrt{\frac{1}{N}{\sum\limits_{i=1}^{N}{\left({{{\hat{y}}_{i}}-{{y}_{i}}} \right)^{2}}}} \tag{15}\]  
\[MAPE=\frac{{100\%}}{N}{\sum\limits_{i=1}^{N}}{\left|{\frac{{{\hat{y}}_{i}}-{{ y}_{i}}}{{y}_{i}}}\right|} \tag{16}\]  
\[R^{2}=1-\frac{{\sum\limits_{i}{{{\left({{\hat{y}}_{i}}-{{y}_{i}}\right)}^{2}} }}}{{\sum\limits_{i}{{{\left({{y}_{i}}-{{y}}\right)}^{2}}}}} \tag{17}\]  
where \(N\) is the number of samples, \({{\hat{y}}_{i}}\) is the predicted battery capacity, and \({{y}_{i}}\) is the actual battery capacity.  
The model error comparison results are presented in Table 7. The results indicate that the PSO-LSTM model achieves the lowest MAE, RMSE, and MAPE values across all datasets, demonstrating its superior predictive performance. Additionally, the PSO-LSTM model exhibits the highest \(\text{R}^{2}\) values, highlighting its excellent data-fitting capability, making it the most stable and optimal choice among the three methods. In contrast, the performance of the PSO-CNN model lies between that of PSO-LSTM and PSO-SVR. While its errors are slightly higher than those of PSO-LSTM, it significantly outperforms PSO-SVR, showcasing strong practicality and reliable fitting capability. On the other hand, the PSO-SVR model exhibits the weakest performance across all datasets and metrics, with larger errors and the lowest \(\text{R}^{2}\) values, indicating its relatively poor predictive ability.