## 2 Improved Wavelet Threshold Denoising Method
### Method Improvement via Optimizing Wavelet Parameters
#### 2.4.3 Optimal Decomposition Layers  
The selection of optimal decomposition layers is the key to the denoising effect. If the number of layers is too low, the noise will remain in the data. If the number of layers is too high, part of the detail signal will be removed as noise. Generally, when the number of layers increases, the effect of wavelet denoising becomes first better and then worse. There are three commonly used indexes for evaluating the denoising effect, including the root mean square error (RMSE), the signal-to-noise ratio (SNR) and smoothness (SMOT). The RMSE is the square root of the variance between the original signal and the denoised signal. The SNR is a traditional method to measure noise in signals. It refers to the ratio of the original signal energy to noise energy. The higher the SNR, the better the filtering effect. SMOT is the ratio of the variance root of the difference between the denoised signal to the original signal, reflecting the smoothness and continuity of the signal after denoising. The smaller the smoothness is, the better the denoising effect is. The formulas of the three indexes and their changing trends according to the number of layers are shown in Table 1, where \(x_{i}\) is the original signal, \(\hat{x_{i}}\) is the denoised signal, and \(N\) is the total amount of data. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Index** & **Formula** & **Core Concern** & **Correlation with the Number of Layers** & **Correlation with Denoising Effect** \\ \hline RMSE & \(\sqrt{\frac{1}{N}\sum\limits_{i=1}^{N}(\hat{x_{i}}-x_{i})^{2}}\) & high frequency detail & positively correlated & negatively correlated \\ SNR & \(10\log_{10}\frac{\sum_{i=1}^{N}x_{i}^{2}}{\sum_{i=1}^{N}(x_{i}-\hat{x_{i}})^{2}}\) & high frequency detail & negatively correlated & positively correlated \\ SMOT & \(\frac{\sqrt{\sum_{i=1}^{N}(x_{i}^{2}-\hat{x_{i}})^{2}}}{\sqrt{\sum_{i=1}^{N}(x _{i}-x_{i})^{2}}}\) & low frequency & negatively correlated & negatively correlated \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Formulas and characteristics of three evaluation indexes. Since the single index is unstable and unreliable, to integrate the three indexes, a comprehensive evaluation based on the variation coefficient method is adopted [23]. The weights are derived from the coefficient of variation method with the following steps:  
1. Calculate the index value of each layer As the number of wavelet decomposition layers in a practical application generally does not exceed nine layers, the indexes are calculated according to the formulas in Table 1 for 2-9 decomposition levels. 2. Normalization of all indexes Since the dimension of each index is different, it is necessary to carry out normalization before the integration. Assume \(x_{ij}\) is the calculated index in step(1), where \(i\) represents the number of wavelet layers, and \(j\) represents the index. RMSE and SMOT are negatively correlated with the denoising effect, so the normalized formula is shown in Equation (7). \[x_{ij}^{0}=\frac{x_{ij}-\min\bigl{(}x_{ij}\bigr{)}}{\max\bigl{(}x_{ij}\bigr{)}- \min\bigl{(}x_{ij}\bigr{)}}\] (7)  
SNR is negatively correlated with the denoising effect, so the normalized formula is presented in Equation (8). \[ \begin{array}{l}x_{ij}^{0}=\frac{\max\bigl{(}x_{ij}\bigr{)}-x_{ij}}{\max \bigl{(}x_{ij}\bigr{)}-\min\bigl{(}x_{ij}\bigr{)}}\\ i\in\{1,2,..9\}\,\ j\in\{1,2,3\}\end{array}  \tag{8}\]
3. Calculate the weight of each index The greater the variance of the index value, the more it can reflect the difference between the evaluated units, and it should account for more weights in the comprehensive score. Based on this idea, the commonly used coefficient of variation method sets the weight of the index as the quotient of the standard deviation and mean of different levels, as shown in Equation (9). \[w_{j}=\frac{\operatorname{std}\Bigl{(}x_{ij}^{0}\Bigr{)}}{\operatorname{mean} \Bigl{(}x_{ij}^{0}\Bigr{)}} \tag{9}\]  
Then, the normalized weight of each index is obtained by Equation (10).