# Lithium-Ion Battery Capacity Prediction with GA-Optimized CNN, RNN, and BP
## 4 Results and Discussion  
After normalizing the extracted features and capacities and partitioning them into training and testing sets, the first step involves determining the optimal parameters. Therefore, the relevant parameters of the RNN, CNN, and BP algorithms were optimized using GA to achieve the lowest RMSE value. The GA options used during optimization are summarized in Table 3 based on the respective algorithms. Except for the range values, the other parameter values were kept the same for all algorithms. The main reason for this decision is that for BP and RNN, high values of hiddenlayersize lead to an increase in RMSE and an interruption of the program. In the BP and RNN algorithms, a large hidden layer size can lead to the overfitting of the models and reduce the generalization ability of the model. It also increases the training and prediction processes and increases the memory requirement. As a result, it is appropriate to keep this parameter in this range, as using a high number of hidden layers will lead to more complexity and low performance over a longer time. For CNN, no such problem was encountered up to 2000 in the filternumber value, but at higher values, again, positive values for RMSE cannot be obtained. Therefore, the range 1-2000 was chosen. The parameters obtained through genetic algorithm (GA) optimization, based on the aforementioned choices, are presented in Table 4. During the GA process, the parameters are derived from the best-performing individual after conducting 20 iterations, as mentioned earlier. This optimization process is repeated separately for different training datasets of each battery. The performance criterion used here is RMSE, which is commonly compared in the literature. Typically, the CNN algorithm demonstrates superior performance with a \"filtersize\" value of 1. However, optimal results were observed with \"filtersize\" values of 10 and 3 for the cases of 70 and 100 training data in the B0006 battery, respectively. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline  & & **CNN** & & & **BP** & & **RNN** & \\ \hline  & 40 & 70 & 100 & 40 & 70 & 100 & 40 & 70 & 100 \\ \hline
**B0005** & 1969 & 969 & 1344 & 43 & 86 & 3 & 18 & 12 & 12 \\ \hline
**B0006** & 1719 & 157(10) 1 & 63(3) 1 & 68 & 3 & 3 & 18 & 18 & 92 \\ \hline
**B0007** & 1844 & 1719 & 157 & 18 & 3 & 3 & 86 & 61 & 68 \\ \hline
**B0018** & 1844 & 1969 & 844 & 68 & 3 & 4 & 49 & 12 & 4 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Genetic Algorithm Results. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Algorithm** & **CNN** & **BP** & **RNN** \\ \hline
**Parameter** & (Filternumber) & (hiddenlyresize) & (hiddenlyresize) \\ \hline
**Population** & 5 & 5 & 5 \\ \hline
**Max. gen.** & 20 & 20 & 20 \\ \hline
**Range** & 1–2000 & 1–100 & 1–100 \\ \hline
**Func. toler** & \(10^{-6}\) & \(10^{-6}\) & \(10^{-6}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Genetic Algorithm Options. The most optimal parameters for B0005 were determined and the relevant training data were used. The prediction results, obtained by averaging five iterations for 40, 70, and 100 training data, are presented in Table 5. Based on these results, the GA-CNN model exhibited the highest performance for all values. The most optimal parameters for B0006 were determined and the relevant training data were used. The prediction results, obtained by averaging five iterations for 40, 70, and 100 training data, are presented in Table 6. Generally, except for the case of 70 training data, the GA-CNN model showed the highest performance. However, with 70 training data, the GA-RNN model was found to be the best-performing model in terms of MSE, RMSE, and NRMSE values, while the GA-BP model performed best in terms of MAE value. The GA-CNN model achieved the highest R\({}^{2}\) value. The optimal parameters for the B0007 and B0018 batteries were determined and the relevant training data were used.