# A New Fault Diagnosis Method for Unbalanced Data Based on 1 DCNN and L2-SVM
## 3 The Proposed Method
### L2-SVM Loss with Dynamically Adjusted Parameters and Modulation Factors Is Constructed
 \tag{12}\]  
where \(\eta\) is the dynamic adjustment parameter, and its expression is as follows:  
\[\eta=\left\{ \begin{array}{ll}n_{+}/n&\text{if }n_{+}>n_{-}\\ 0&\text{if }n_{+}=n_{-}\\ -n_{-}/n&\text{if }n_{+}<n_{-}\end{array} \right. \tag{13}\]  
where \(n_{+}\) and \(n_{-}\) are the number of positive and negative training samples, respectively; n represents the total number of training samples; c\((1-\eta)\) and c\((1+\eta)\) are the new dynamic penalty factors. When the samples are balanced, it can be seen from Equation (13) that \(\eta=0\) and the dynamic penalty factors c\((1-\eta)\) and c\((1+\eta)\) are equal to c, which means that the loss will apply the same misclassification penalty to all samples. When the samples are unbalanced, \(\eta\) will be automatically adjusted according to the proportion of positive and negative samples, and the dynamic penalty factors c\((1-\eta)\) and c\((1+\eta)\) will impose different misclassification penalties on positive and negative samples, respectively, decreasing the weight of the majority class samples and increasing the weight of the minority class samples. However, the disadvantage of the new dynamic penalty factor is obvious; in other words, there is a onefold capability of separation between positive and negative samples, without the one between easy-to-classify and hard-to-classify samples. To solve this problem, we add a modulation factor to Equation (12), which yields  
\[ \begin{array}{l}\min_{w,b,\xi_{4}}\frac{1}{2}\|w\|^{2}+c(1-\eta)(1-p_{t})^{ T}\sum\limits_{i=1}^{n_{\ast}}\xi_{i}^{2}+c(1+\eta)(1-p_{t})^{T}\sum\limits_{i=1}^{n_{ \ast}}\xi_{i}^{2}\\ \text{s.t.}\quad\text{yi}(w^{T}x_{i}+b)\geq 1-\xi_{i}\\ \xi_{i}\geq 0,\ i=1,2,\ldots,n\end{array}  \tag{14}\]  
where the expression of \(p_{t}\) is as follows:  
\[P_{t}=\left\{ \begin{array}{ll}P&\text{if }\ \ y=+1\\ 1-p&\text{otherwise}\end{array} \right. \tag{15}\]  
where \(p\in[0,1]\) is the prediction probability of the sample with the label y = +1. When the sample is easy to classify, the prediction probability of the sample is larger (e.g., the larger p is, \(p_{t}\to 1\)), the modulation factor \((1-p_{t})^{\tau}\) becomes smaller, and the corresponding loss is weighted downward; when the sample is hard to classify, the prediction probability of the sample is low (e.g., the smaller p is, \(p_{t}\to 0\)), and the modulation factor \((1-p_{t})^{\tau}\) tends to 1. Currently, the loss of these samples is unaffected. \(\tau\geq 0\) is called the focusing parameter. When \(\tau=0\), Equation (14) is equal to Equation (12); when \(\tau>0\), it can smoothly adjust the rate at which easy samples are downweighted. As \(\tau\) increases, the effect of the modulation factor also increases. In summary, the traditional cross-entropy loss regards the misclassification of different health states as equally important, which minimizes the cross-entropy loss and then the overall sample misclassification. Meanwhile, the improved loss assigns different misclassification costs to distinct classes of samples, decreases the weight of the majority class,and increases the one of the minority class. Furthermore, a modulation factor is added to decrease the weight of easy-to-classify samples, impelling more focus on the training of rare hard-to-classify samples.