# Chinese Character Image Completion Using a Generative Latent Variable Model
## 2 Materials and Methods
### Materials
#### 2.1.1 Variational Autoencoder  
The variant autoencoder (VAE), the model underlying VAE-C, is a type of generative model that uses latent variables [15]. As with the autoencoder model, the VAE is composed of an encoder model and a decoder model.  
However, there is a difference between the VAE and the autoencoder, Firstly, the encoder model outputs the mean \(\mu\) and variance \(\sigma\) on the latent variable distribution as a result value. The mean \(\mu\) and variance \(\sigma\) outputted in this way are used as parameters of the normal distribution equation to form one normal distribution [19]. Randomly sampled values from the formed distribution are used as latent variables. The reason for using this type of structure is to learn \(p(x)\)--the probability distribution of real data \(x\).  
\[p(x)=\ p(x|z) \tag{1}\]  
\[p(x)=E_{z\sim p_{\theta}(z|x)}[\ p(x|z)] \tag{2}\]  
\[p(x)=E_{z\sim p_{\theta}(z|x)}[\ p(x|z)]\ \approx\ E_{z\sim q_{\varphi}(z|x)}[\ p(x|z)] \tag{3}\]  
Equation (1) presents the equation used to calculate the probability of \(x\) by using the latent variable \(z\). It has the role, similar to a decoder, of receiving the latent variable \(z\) as an input value and reconstructing it into real data \(x\). Equation (2) adds the fact that the latent variable \(x\) has a certain probability distribution \(p_{\theta}(z)\) to Equation (1). In the VAE, the latent variable \(z\) is outputted with the form of a probability distribution from the encoder, so Equation (2) is applied. Equation (3) is an equation showing the use of variation inference. The latent variable \(z\) is encoded from the real data \(x\) to form the probability distribution \(p_{\theta}(z|x)\). The probability distribution constructed in this way is utilized as \(q_{\varphi}(z|x)\) simplified into the normal distribution form. Variation inference is a method of  
Figure 1: The overview system diagram of the variational autoencoder with classification (VAE-C). VAE-C has two core technologies: disentangled distribution and target node value control.  
further simplifying the complex distribution (intractable posterior) in this way and then inducing it into the actual distribution.  
\[\mathrm{L}_{\
u}\ =\ \mathrm{E}_{\mathrm{q}_{\varphi}(\mathrm{z}|\mathrm{x})}[ \log\{\mathrm{p}(\mathrm{x}|\mathrm{z})\}]-\ \mathrm{D}_{\mathrm{KL}}(\mathrm{q}_{\varphi}(\mathrm{z}|\mathrm{x})\ ||\ \mathrm{p}( \mathrm{z})) \tag{4}\]  
The loss function of VAE takes the same form as Equation (4) using the induction formula [15], playing the role of bringing the normal distribution \(\mathrm{q}_{\varphi}(\mathrm{z}|\mathrm{x})\) closer to the real data distribution \(\mathrm{p}_{\varphi}(\mathrm{z}|\mathrm{x})\) by Kullback-Leibler divergence (\(\mathrm{D}_{\mathrm{KL}}\)) [20].  
The fact that the latent variable is extracted by sampling from the normal distribution works as an obstacle in training the model through backpropagation. To solve this, reparameterization was used. Using \(\epsilon\ \sim\ \mathrm{N}(0,1)\) randomly sampled from the Gaussian distribution, the latent variable was expressed in the form of a function that can be differentiated, as shown in Equation (5).  
\[\mathrm{z}=\mu+\ \sigma\ \times\ \epsilon \tag{5}\]  
Using a method of learning the probability distribution of data, the VAE has the advantages that the distribution of the data has continuity and that it is able to generate the data in a form that is interpolated between data. These advantages laid the foundation for new artificial data to be generated by adjusting the features of the desired data.