# Solid-State Lithium Battery Cycle Life Prediction Using Machine Learning
## 2 Materials and Methods
### Algorithm Selection  
Cycle life and _RUL_ prediction is a regression task. As there is no clear formula to describe the relationship between the proposed features and cycle numbers quantitatively, we chose symbolic regression (SR), a machine learning model complemented by the genetic programming optimization method, to solve this problem, because it could generate an expression close to the theoretical formula by progressive optimization. The model structure is shown in Figure 5. First, a series of initial functions are randomly generated to roughly fit the mathematical relationship between the proposed features and the _RUL_. Then, this algorithm allows these initial functions to breed, mutate, and evolve on account of the survival of the fittest. We used a Python library called gplearn to implement symbolic regression programming. Hyper-parameters (p_crossover = 0.5, p_subtree_mutation = 0.1, p_hoist_mutation = 0.2, p_point_mutation = 0.1) and function sets ('add,''sub,''mul,' 'div,''sqrt,' 'log,' 'abs,' 'neg,' 'inv,''max,''min') were adopted herein to obtain a brief but accurate description formula. The experimental setup of hyper-parameters in the SR model is shown in Table 1.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline population size & 5000 \\ Generations & 5 \\ stopping criteria & 0.01 \\ p\_crossover & 0.7 \\ p\_subtree\_mutation & 0.1 \\ p\_hoist\_mutation & 0.05 \\ p\_point\_mutation & 0.1 \\ function set & ‘add,’'sub’, ‘mul’, ‘div’, ‘sqrt’, ‘log’, ‘abs’,’neg’, \\  & ‘inv’,’'max’, ‘min’ \\ parsimony coefficient & 0.001 \\ \hline \hline \end{tabular} p\({}_{crossover}\) is used to control the probability of mixing components between individual trees, while subtree will be replaced by a naive random element during mutation, which is controlled by p_subtree_mutation. A high p_hoist_mutation number could avoid too complicated a formula, and p_point_mutation could bring opportunities for reintroducing diminutive functions and operators. The above probabilities were chosen to trade-off the complexity against the accuracy of formulas.  
\end{table}
Table 1: The experimental setup of hyper-parameters in SR model.  
The coefficient of determination (\(R^{2}\)) and root-mean-square error (RMSE) were chosen to evaluate the model performance. \(R^{2}\) and RMSE are frequently chosen to evaluate the machine learning model performance [39; 40]. \(R^{2}\) could reflect the fitting degree of the regression equation, and the formula is as follows:  
\[R^{2}(y,\hat{y})=1-\frac{\sum_{i=0}^{n-1}{(y_{i}-\hat{y}_{i})^{2}}}{\sum_{i=0}^{ n-1}{(y_{i}-\overline{y})^{2}}} \tag{5}\]  
\[\overline{y}=\frac{1}{n}\sum_{i=0}^{n-1}{y_{i}} \tag{6}\]  
where \(\hat{y}_{i}\) represents the predicted value of the ith sample, \(y_{i}\) is the corresponding true value, and \(n\) denotes the number of samples. The best possible score is 1.0 and it would be negative if the model is arbitrarily worse. RMSE is defined as [4]:  
\[RMSE=\sqrt{\frac{1}{n}\sum_{i=1}^{n}{(y_{i}-\hat{y}_{i})^{2}}} \tag{7}\]  
where \(y_{i}\) is the observed cycle life, \(\hat{y}_{i}\) is the predicted cycle life, and \(n\) is the total number of samples.