## 4 Research on the Data Derivation Method Based on CTGAN
### Principle of CTGAN  
To complete the task of generating tabular data, CTGAN enhances the training process through normalization for patterns and framework changes for patterns and solves the problem of data imbalance using conditional generators and sampling training. By combining Gaussian mixture models with VAE, CTGAN is capable of learning the latent representations of data and generating new tabular data samples. This combined  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Number** & **Index** & **Unit** \\ \hline X1 & Box internal temperature & \({}^{\circ}\)C \\ X2 & Box internal humidity & RH \\ X3 & Water immersion in the box & mL \\ X4 & Smoke detection in the box & ppm \\ X5 & Condensation in the box & mL \\ X6 & Contact resistance & \(\Omega\) \\ X7 & Partial discharge & pC \\ X8 & Dielectric loss rate & / \\ X9 & Winding absorption ratio & / \\ X10 & Core ground current & A \\ X11 & Core temperature & \({}^{\circ}\)C \\ X12 & Frequency & Hz \\ X13 & Voltage of the h-v & KV \\ X14 & Current of the h-v & A \\ X15 & Incoming line voltage of the l-v & V \\ X16 & Outgoing line voltage of the l-v & V \\ X17 & Incoming line current of the l-v & A \\ X18 & Outgoing line current of the l-v & A \\ X19 & Busbar temperature & \({}^{\circ}\)C \\ X20 & Neutral current & A \\ X21 & Action rejection message & / \\ X22 & Trip information & / \\ X23 & Temperature of circuit contacts & \({}^{\circ}\)C \\ X24 & Circuit breaker current & A \\ \hline \hline \end{tabular}
\end{table}
Table 1: Fault indicators of box-type substations.  
approach helps solve the problems of data encoding and generation and improves the sample efficiency and quality of the model.  
CTGAN consists of two models that present a competitive game relationship: the generative model G, which captures the distribution of data, and the discriminative model D, which estimates the probability of the sample coming from the original data. The G network generates fault samples by transmitting random noise through a multi-layer perceptron, and the D network is also composed of a multi-layer perceptron, learning and judging whether the samples come from the model distribution or the original data distribution. Under the definition of G and D by the multi-layer perceptron, the whole system can be trained by the backpropagation mechanism, and the two achieve an antagonistic game balance. In addition, there is an encoder that models the raw data, and a classifier trained on the raw data to better interpret the semantic integrity of the data. The CTGAN structure is shown in Figure 3.  
The CTGAN training process is as follows:  
Step 1: Random noise z and conditional vectors are input into the generator to generate data G(z) in the specified format;  
Step 2: The original data sample x is modeled through the encoder and input into the discriminator together with the generated data G(z) and the conditional vector;  
Step 3: The discriminator distinguishes the original data sample x and the generated data sample G(z), respectively, and then updates the weight of the discriminator D through the backpropagation of the loss function; that is, the discriminator continuously improves its ability to discriminate generated data samples;  
Step 4: According to the output of the discriminator, constantly adjust the parameters of generator G; that is, improve the ability of the generator to generate data, making the data generated as consistent as possible with the original data so that the discriminator cannot correctly discriminate;  
Step 5: Repeat Step 1-Step 4 until the loss function of the discriminator converges within a certain number of iterations and stops training.