# A Deep Parallel Diagnostic Method for Transformer Dissolved Gas Analysis
## 2 Materials and Methods
### Dataset Acquisition and Processing
#### 2.1.2 ADASYN's Principle and Implementation  
The occurrence frequency of different fault types in the given dataset is significantly different. If the imbalanced dataset is used directly to train a deep learning framework, the results will not be ideal. In view of the adverse effects of the imbalanced dataset, the task of balancing the original dataset should be given priority. The basic idea of the SMOTE algorithm is to artificially synthesize new samples of the minority class based on the given dataset in order to balance and expand the dataset [41]. One of its obvious limitations is that the objects of the minority class are homogenized. The facts show that the importance and impact of different fault samples on the further learning of the diagnostic models are not similar. In addition, if the fault samples in the original dataset were mixed with noise, assigning the same oversampling weight to all the fault samples in the minority class may be counterproductive. In addition, many studies have shown that during the training process, fault samples closer to the decision boundary contribute more to the establishment of classification boundaries than other fault samples. In order to solve this limitation for the transformer DGA imbalanced dataset, we propose to use an adaptive form of SMOTE, called the ADASYN algorithm, to enhance the imbalanced dataset. The steps of the ADASYN algorithm are as follows:  
First, define multiple data spaces: \(\Gamma_{i}(i=1,2,\ldots,m-1)\) and \(\Gamma_{i\ |\ i=m}\), which represent spaces for fault samples in minority class and space for fault samples in the majority class, respectively. In this paper, \(m\)\(=6\). \(\Gamma_{1}\) represents space for samples with a high temperature overheating fault; \(\Gamma_{3}\) represents space for samples with a medium temperature overheating fault; \(\Gamma_{4}\) represents space for samples with a low temperature overheating fault; \(\Gamma_{4}\) represents space for samples with a partial discharge fault; \(\Gamma_{5}\) represents space for samples with a high energy discharge fault; \(\Gamma_{6}\) which has the highest number of samples, represents space for samples with a low energy discharge fault. Each space has five dimensions because there are five different fault characteristic indexes. However, for the convenience of illustration, the space will be converted into a two or three-dimensional diagram in this paper. Next, supposed the number of neighbors of the \(j\)-th fault sample \(p_{i,j}\) in the \(i\)-th minority class data space \(\Gamma_{i}\) is \(z\), then calculate its local reachability density to the majority fault samples cluster as well as the minority fault samples cluster. The calculated result can be, respectively, noted as \(D_{i,j}^{maj}\) and \(D_{i,j}^{\min}(j=1,2,\ldots,n_{i})\). Local reachability density is defined by  
\[D_{i,j}=\frac{1}{\frac{\sum\limits_{ \begin{subarray}{c}i\
eq Z\\ i\
eq Z\end{subarray} }\text{Distance}(q_{i}p_{i,j})}{z}} \tag{3}\]  
where \(Z\) is the nearest neighbor set of the fault sample \(p_{i,j}\) when the number of neighbors is \(z\), and \(q\) is the neighbors of \(p_{i,j}\) in \(Z\). The meaning of the local reachability density is illustrated in Figure 2. The pink ball represents fault samples of the \(i\)-th minority class and the blue prism represents fault samples of the majority class. When \(z\) is equal to \(5\), \(D_{i,j}^{\min}\) of the selected minority fault sample \(p_{i,j}\), which is positioned at the origin of coordinates, is big, while its \(D_{i,j}^{maj}\) is small, indicating that there are more fault samples of the same minority class in the neighborhood. Thus, the learning of this selected fault sample is not too difficult. The learning difficulty can be quantified by the ratio of \(D_{i,j}^{maj}\) and \(D_{i,j}^{\min}\), as shown in Equation (4). Therefore, the learning difficulty of each minority fault sample can be quantified so that each fault sample can be assigned a tailor-made oversampling weight according to its learning difficulty.