## 4 Discussion and Final Remarks
### General Discussion  
Among the time series methods, DTW shows the closest approximation to the actual similarity percentages (in cycle 1) across three out of four trajectories. Thus, DTW performs well when estimating the contribution percentage of aging trajectory 2 (error of 0.2%) but drops to \(-23.1\%\) and \(-26.8\%\) for aging trajectories 3 and 4, respectively. In contrast, TAM shows consistent but larger deviations from the actual similarity percentages. The weighted average error for DTW is \(-7.8\%\), substantially lower than TAM's \(-12.8\%\), indicating a better overall alignment with the actual data. DTW is believed to perform well in certain cases when trajectories follow similar shapes but are shifted or stretched in time/cycles while dynamically aligning sequences, making it suitable for misaligned phases. However, this method is quite sensitive to local fluctuations, which could explain the errors estimated when comparing cycle 1 to aging trajectories 3 and 4. On the other hand, TAM underperforms as it utilizes linear segment alignments that may not capture  
\begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline \multicolumn{1}{c}{\multirow{2}{*}{**Aging**}} & \multicolumn{4}{c}{**Time Series**} & \multicolumn{4}{c}{**Tree-Based**} \\ \cline{2-13}
**Trajectory** & **DTW** & **\% Error** & **TAM** & **\% Error** & **RF** & **\% Error** & **RF-DTW** & **\% Error** & **PRFTN** & **\% Error** \\ \hline
1 & 29.7 & \(-3.6\) & 25.8 & \(-7.5\) & 26.3 & \(-7.0\) & 29.1 & \(-4  
nonlinear aging behaviours or, due to providing more conservative alignments, leads to lower accuracy. Regarding the tree-based methods, PRFTN performs the best, with a weighted average error of \(-6.2\%\), outperforming RF (\(-12.3\%\)) and RF-DTW (\(-9.0\%\)). Nevertheless, PRFTN also reported the highest absolute error among all trajectories and methods for trajectory 4 (\(-37.3\%\)). A unique feature of this comparison is the highest similarity percentage error of \(41.6\%\), estimated by PRFTN for trajectory 1, which suggests a higher sensitivity to certain trajectory features. While the following lowest absolute error is for DTW, a model robustness analysis to noise for DTW and RF-DWT reveals that adding Gaussian noise to the capacity included in the cycle (from the standard deviation of 0 to 0.5) increases the weighted average error to \(1.9\%\) for DTW and \(0.7\%\) for RF-DTW. RF-DTW tends to be more robust to noise than pure DTW, as merging RF into DTW helps ensemble smoothing, due to bootstrapping and aggregation decisions from many trees, a better generalization since trees are trained on subsets of samples. Equal distributions of contributions are observed for RF and TAM. RF can be affected by shallow trees and uniform terminal nodes, while TAM is influenced by over-aggregation and poor/wide aggregation windows, potentially leading to flat similarities. Across all methods, aging trajectory 2 is the most accurately estimated, while aging trajectory 4 is consistently the most challenging for all methods, exhibiting considerably large negative errors. Tree-based methods generally show less variability across trajectories than time series methods, indicating better generalization. While the previous discussion pertains to cycle 1, similar findings and trends were observed across several artificially generated cycles, with absolute errors ranging from \(-40\) to \(10\%\). Our discussion led us to select RF-DTW as the most reliable similarity-based method for diagnosing the aging of lithium-ion batteries in second life, based on the aging trajectories evaluated in this work. Another alternative to standalone similarity-based methods is the use of hybrid approaches, which combine two or more of the previous methods. Thus, a stacking ensemble is proposed, utilizing linear regression to combine the predictions of multiple similarity-based methods for trajectory analysis.