# DC-MMD-GAN: A New Maximum Mean Discrepancy Generative Adversarial Network Using Divide and Conquer
## 3 Divide and Conquer MMD-GANs
According to [31], the deviation between \(\text{MMD}_{\text{em}}\)2 and \(\text{MMD}\)2 converges in a Gaussian distribution as  
\[\left(\text{MMD}_{\text{em}}\text{2}-\text{MMD}\text{2}\right)\overset{D}{ \longrightarrow}\mathcal{N}(0,\sigma_{u}\text{2}\text{2}\text{2}\text{2}\text{ 2}\text{2}\text{2}\text{2}\text{2}\text{2}\text{2}\text{2}\text{2}\text{2} \text{2}\text{2}\text{2  
the B-test [31] can obtain a more precise empirical estimate of MMD by computing an average over empirical estimates calculated on subsets. Inspired by the divide-and-conquer strategy for kernel methods [17; 18; 19; 20], we propose a divide-and-conquer generative model, DC-MMD-GANs. We partition training images into \(c\) subsets \(\{R_{1},R_{2},...,R_{c}\}\) using auto-encoder and k-means in the latent space. The sub-models conduct forward propagation using different subsets independently. The loss function values of sub-models are integrated and used to calculate a new weight-sum loss to update the all sub-models synchronously. The framework of our proposed method is shown in Figure 2.  
The purpose of dividing training data is to reduce the loss of information and improve the generating performance. The advantages of division task is shown as follows:  
1. Each subset of training images divided by k-means owns minimum distance in embedding space. The correlation between each subset is reduced. \(\text{MMD}_{\text{em}}{}^{2}(R_{i},R_{j})_{i\
eq j}\) between each subset gets bigger. \(R_{i}\) and \(R_{j}\) are different batches of training images of different subset. According to Equation (5), the third term in \(\text{MMD}_{\text{em}}{}^{2}(R_{i},R_{j})_{i\
eq j}\) will be reduced, which is the cross term between different subsets and cannot be obtained due to independent sub-model. From this perspective, auto-encoder and k-means help to reduce the loss of information of training images during training process.
2. Each subset of training images is used to train on one sub-model. All training images are learned more quickly compared with the baseline model.
3. According to different cluster of embeddings, we divide images into subsets, which can be viewed as different categories. Divided subsets contain different information of clustered embeddings, which is shown to improve training of GANs [32]. A pre-trained model such as the combination of auto-encoder and k-means is shown to be benefit for generator to produce high-quality images [33].  
Figure 1: Illustration of the probability of \(|\text{MMD}_{\text{em}}{}^{2}-\text{MMD}^{2}|\) exceeding deviation \(t\). The horizontal axis is batch size. The number next to the curve is the probability of exceeding different deviation \(t\) under the specific batch size. The figure shows that the probability of exceeding large deviation is high under the small batch size. Generally, the batch size in MMD-GANs is less than 128 and the deviation of loss function is large. Under the same deviation \(t\), the probability of exceeding \(t\) decreases with increasing of batch size.  
The target distribution \(\mathbb{P}_{r}\) is primarily supported by low-dimensional manifolds [10]. We try to learn useful feature representation, which can represent the essence of the target distribution. Auto-encoder has enough capacity to capture prominent information of target data. By mapping training images space \(\mathbb{R}^{d}\) into low-dimensional embedding space \(\mathbb{R}^{e}\), the encoder outputs the most representative embedding \(e\)[34]. Furthermore, auto-encoder disentangles complex variations of training images which is beneficial for division tasks [35].  
Figure 2: The structure of the DC-MMD-GANs. We train an auto-encoder and get embedding of training images from the output of encoder. K-means clusters on the embedding of auto-encoder into adaptive subsets. We divide the training images into subsets according to embedding subsets. Each sub-model is trained independently with different subsets. The master node computes the new weight-sum loss function and obtains precise empirical estimate based on output of sub-models.  
We train auto-encoder with all training images by minimizing mean squared errors (MSE) between training data and reconstructed samples. The dimension of the output layer of the encoder was set to 256 with three convolution layers and two fully connected layers. Auto-encoder is composed of encoder and decoder, which is shown as follows  
\[\min_{\mathcal{D}_{c}\mathcal{E}_{c}}\mathcal{Loss}=\frac{1}{m}\sum _{i=1}^{m}\left\|r_{i}-\mathcal{D}_{c}\left(\mathcal{E}_{c}\left(r_{i}\right) \right)\right\|^{2},\] \[e=\mathcal{E}_{c}\left(R\right),e\in\mathbb{R}^{c},\] \[\hat{R}_{re}=\mathcal{D}_{c}\left(\mathcal{E}_{c}\left(R\right) \right), \tag{9}\]  
where \(\mathcal{E}_{c}(\cdot)\) is encoder and \(\mathcal{D}_{c}(\cdot)\) is decoder.