# Credibility Based Imbalance Boosting Method for Software Defect Proneness Prediction
## 3 Methodology
### Proposed Credibility-Based Imbalance Boosting Method
#### 3.2.2 Update the Weights of Synthetic Samples in Boosting Iterations  
After calculating the credibility factors of all the synthetic samples, a new training dataset (denoted as \(S_{com}\)) that consists of both synthetic samples and real samples is obtained. The initial weights of synthetic samples are their credibility factors and the weight of each real sample is set to be 1 (i.e., the largest credibility factor). That is to say, real samples have complete credibility when compared to the synthetic samples. We denote the initialized distribution weights of \(S_{com}\) as \(D_{1}\). And then \(S_{com}\) is normalized to ensure the sum of all weights is equal to 1. For \(t\)-th \(\left(t=1,2,\cdots,T\right)\) iteration, we first train the given base classifier on \(S_{com}\) with distribution weights \(D_{t}\) and then denote the trained classifier as \(h_{t}\). We next calculate the weighted misclassification error of \(h_{t}\) on \(S_{com}\), as follows:  
\[\varepsilon_{t}=\sum_{j:h_{t}\left(x_{j}\right)\
eq y_{j}}D_{t}\left(x_{j}\right) \tag{3}\]  
where \(N\) denotes the number of samples of \(S_{com}\).  
Based on the error \(\varepsilon_{t}\), the distribution weight \(D_{t}\) is updated, as follows:  
\[D_{t+1}\left(x_{i}\right)=\left\{\begin{array}{cc}\frac{D_{t}\left(x_{i} \right)*e^{-\varepsilon_{i}}}{Z_{t}}&if\ h_{t}\left(x_{i}\right)=y_{i},\ x_{i}\in S _{tr}\\ \frac{D_{t}\left(x_{i}\right)*e^{\varepsilon_{i}}}{Z_{t}}&if\ h_{t}\left(x_{i} \right)\
eq y_{i},\ x_{i}\in S_{tr}\\ \frac{D_{t}\left(x_{i}\right)*cf_{i}}{Z_{t}}&if\ x_{i}\in S_{syn}\end{array}\right. \tag{4}\]  
where \(Z_{t}\) is a normalization factor, \(Z_{t}=\sum_{x_{i}\in S_{syn}}D_{t}\left(x_{i}\right)*cf_{i}+\sum_{h_{t}\left( x_{i}\right)=y_{i},\ x_{i}\in S_{tr}}D_{t}\left(x_{i}\right)*e^{-\kappa_{i}}+\sum_{h_{t} \left(x_{i}\right)\
eq y_{i},\ x_{i}\in S_{tr}}D_{t}\left(x_{i}\right)*e^{ \kappa_{i}}\).  
In the above weight updating scheme, the weights of synthetic samples are dependent on the weights of nearest real minority class samples in their \(k\) neighbors and the classification results of weak classifiers on them. In other words, in each iteration, if the real minority class sample is misclassified, then its weight as well as weights of those synthetic samples close to it are increased together. The decision boundaries are extended to those misclassified real minority class by increasing weights of synthetic samples around them. Meanwhile, the weights of those synthetic samples that have no real minority class samples around are decreased by their low credit factors, as they should be neglected to avoid shifting decision boundary incorrectly to minority class, which may result in sacrificing the accuracy of majority class samples. When the iteration stop condition is satisfied, then we can obtain the final hypothesis, i.e., the learned classifier \(h_{f\left(x\right)}\), as follows:  
\[h_{f}\left(x\right)=\underset{y}{argmax}\sum_{t=1}^{T}\alpha_{t}\sigma\left(h _{t}\left(x\right)\right) \tag{5}\]  
where \(\alpha_{t}\) is the weight of \(t\)-th trained base learner \(h_{t}\left(x\right)\).