Skip to content

Advertisement

  • Research
  • Open Access

Fast cosmic web simulations with generative adversarial networks

Computational Astrophysics and CosmologySimulations, Data Analysis and Algorithms20185:4

https://doi.org/10.1186/s40668-018-0026-4

  • Received: 31 July 2018
  • Accepted: 15 November 2018
  • Published:

Abstract

Dark matter in the universe evolves through gravity to form a complex network of halos, filaments, sheets and voids, that is known as the cosmic web. Computational models of the underlying physical processes, such as classical N-body simulations, are extremely resource intensive, as they track the action of gravity in an expanding universe using billions of particles as tracers of the cosmic matter distribution. Therefore, upcoming cosmology experiments will face a computational bottleneck that may limit the exploitation of their full scientific potential. To address this challenge, we demonstrate the application of a machine learning technique called Generative Adversarial Networks (GAN) to learn models that can efficiently generate new, physically realistic realizations of the cosmic web. Our training set is a small, representative sample of 2D image snapshots from N-body simulations of size 500 and 100 Mpc. We show that the GAN-generated samples are qualitatively and quantitatively very similar to the originals. For the larger boxes of size 500 Mpc, it is very difficult to distinguish them visually. The agreement of the power spectrum \(P_{k}\) is 1–2% for most of the range, between \(k=0.06\) and \(k=0.4\). For the remaining values of k, the agreement is within 15%, with the error rate increasing for \(k>0.8\). For smaller boxes of size 100 Mpc, we find that the visual agreement to be good, but some differences are noticable. The error on the power spectrum is of the order of 20%. We attribute this loss of performance to the fact that the matter distribution in 100 Mpc cutouts was very inhomogeneous between images, a situation in which the performance of GANs is known to deteriorate. We find a good match for the correlation matrix of full \(P_{k}\) range for 100 Mpc data and of small scales for 500 Mpc, with 20% disagreement for large scales. An important advantage of generating cosmic web realizations with a GAN is the considerable gains in terms of computation time. Each new sample generated by a GAN takes a fraction of a second, compared to the many hours needed by traditional N-body techniques. We anticipate that the use of generative models such as GANs will therefore play an important role in providing extremely fast and precise simulations of cosmic web in the era of large cosmological surveys, such as Euclid and Large Synoptic Survey Telescope (LSST).

Keywords

  • Methods: numerical
  • Cosmology
  • Large-scale structure of Universe

1 Introduction

The large scale distribution of matter in the universe takes the form of a complicated network called the cosmic web (Bond et al. 1996; Coles and Chiang 2000; Forero-Romero et al. 2009; Dietrich et al. 2012; Libeskind et al. 2017). The properties of this distribution contain important cosmological information used to study the nature of dark matter, dark energy, and the laws of gravity (DES Collaboration 2017; Hildebrandt et al. 2017; Joudaki et al. 2017), as different cosmological models give rise to dark matter distributions with different properties. Simulations of these cosmic structures (Springel 2005; Potter et al. 2017) play a fundamental role in understanding cosmological measurements (Fosalba et al. 2015; Busha et al. 2013). These simulations are commonly computed using N-body techniques, which represent the matter distribution as a set of particles that evolve throughout cosmic time according to the underlying cosmological model and the laws of gravity. Creating a single N-body simulation requires the use of large computational resources for a long period of time such as days or weeks (Teyssier et al. 2009; Boylan-Kolchin et al. 2009). Furthermore, reliable measurements of cosmological parameters typically require a large number of simulations of various cosmological models (Harnois-Déraps and van Waerbeke 2015; Kacprzak et al. 2016). This creates a strong need for fast, approximate approaches for generating simulations of cosmic web (Heitmann et al. 2010a; Heitmann et al. 2009b; Lawrence et al. 2010; Lin and Kilbinger 2015; Howlett et al. 2015).

Here we demonstrate the possibility of using deep generative models to synthesize samples of the cosmic web. Deep generative models (Kingma and Welling 2014; Goodfellow et al. 2014) are able to learn complex distributions from a given set of data, and then generate new, statistically consistent data samples. Such a deep generative model can be trained on a set of N-body simulations. Once the training is complete, the generative model can create new, random dark matter distributions that are uncorrelated to the training examples. A practical advantage of using a generative model is that the generation process is extremely fast, thus giving us the ability to generate a virtually unlimited number of samples of the cosmic web. Having access to such a large amount of simulations can potentially enable more reliable scientific studies and would therefore enhance our ability to understand the physics of the Universe.

In the last decade, deep learning approaches have achieved outstanding results in many fields, especially for computer vision tasks such as image segmentation or object detection (Krizhevsky et al. 2012). Deep convolutional neural networks (DCNN) have also recently been used as data generating mechanisms. Here a latent random vector, typically a high-dimensional Gaussian, is passed through a DCNN in order to output images. Generative Adversarial Networks (GAN) create such a model by adopting an adversarial game setting between two DCNN players, a generator and a discriminator. The goal of the generator is to produce samples resembling the originals while the discriminator aims at distinguishing the originals from the fake samples produced by the generator. The training process ends when a Nash equilibrium is reached, that is when no player can do better by unilaterally changing his strategy.

The rise of deep generative models has sparked a strong interest in the field of astronomy. Deep generative models have been used to generate astronomical images of galaxies (Regier et al. 2015; Ravanbakhsh et al. 2017; Schawinski et al. 2017) or to recover certain features out of noisy astrophysical images (Schawinski et al. 2017). GANs were recently applied to generating samples of projected 2D mass distribution, called convergence (Mustafa et al. 2017). This approach can generate random samples of convergence maps, which are consistent with the original simulated maps according to several summary statistics. The projection process, however, washes out the complex network structures present in the dark matter distribution. Here, we instead focus on generating the structure of the cosmic web without projection, therefore preserving the ability of the generative model to create halos, filaments, and sheets. We accomplish our goal by synthesizing thin slices of dark matter distribution which have been pixelised to create 2D images that serve as training data for a GAN model.

A demonstration of this method on 2D slices presents a case for the development of deep learning methods able to generate full, 3D dark matter distributions. For cosmological applications, it may be more efficient to work with the full 3D matter distributions generated by a GAN, rather then 2D convergence maps. For gravitational lensing, the convergence map depends on the input distribution of background galaxies (see (Refregier 2003), for review); the 3D matter distribution is projected onto the sky plane by integrating the mass in radial direction against a lensing kernel, which depends on distribution \(n(z)\) of redshifts z of background galaxies. For most lensing studies, the uncertainty on \(n(z)\) is large and is effectively marginalised over. If the 3D distributions are simulated, then the projection can be done analytically, for a given \(n(z)\) (Harnois-Déraps et al. 2012; Sgier et al. 2018). For a 2D generative model, a separate GAN would have to be trained for each \(n(z)\) distribution. This may be particularly important for analyses beyond the power spectrum, such as peak statistics (Dietrich and Hartlap 2010; Kacprzak et al. 2016; Martinet et al. 2018) or deep learning (Schmelzle et al. 2017; Gupta et al. 2018), which use simulations to predict both the signal and its uncertainty. In this paper we demonstrate the feasibility of GAN-based methods for capturing the type of matter distributions characteristic for in N-body simulations. As the development of 3D generative methods for N-body data is likely to be a very challenging due to scalability issues and memory requirements, we consider this to be an important step in asserting that this approach is worth pursuing further.

In learning the cosmic web structures, which are more feature-rich than projected convergence maps, we encountered and addressed several important challenges. The first was to handle data with very large dynamic range of the data; the density in the images created from slices of N-body simulations span several orders of magnitude. Secondly, we explored how mode collapse, a feature of GANs causing the model to focuses on a single local minimum, affects the quality of results (Tolstikhin et al. 2017; Metz et al. 2016; Salimans et al. 2016). As mode collapse is expected to depend on the degree of homogeneity between samples, we tested the performance of GANs for both large and small cosmological volumes, of size 500 and 100 Mpc; the matter density distributions in large boxes are considerably more homogeneous than in small boxes.

Finally, expanding on the work of (Mustafa et al. 2017), we additionally evaluate the cross-correlations of the GAN-generated data with itself and the training set. A high cross-correlation would be an indication of lack of independence between the generated samples, a feature which we would judge to be undesirable in this task.

The paper is organised as follows. In Sect. 2 we describe the Generative Adversarial Networks. Section 3 contains the information on N-body simulations used. Our implementation of the algorithm is described in Sect. 4 and diagnostics used to evaluate its performance are detailed in Sect. 5. We present the results in Sect. 6 and conclude in Sect. 7.

2 Generative adversarial networks

The basic idea behind GANs consists in pairing-up two neural networks: a generator network G and a discriminator network D. These networks are trained in an adversarial game setting. The discriminator \(D: {\bf x}\mapsto[0; 1]\) tries to probabilistically classify a sample \({\bf x}\) as being real or fake. On the other hand, the generator \(G: \mathbf {z}\mapsto{\bf x}\) tries to generate samples that look like they were drawn from the true data distribution \(p_{\text{data}}\). This generator makes use of a random variable z drawn from a given prior \(p_{\text{prior}}(\mathbf {z})\) which is typically a Gaussian distribution. Formally, the two networks D and G play the following two-player minimax game:
$$\begin{aligned} \min_{G} \max_{D} \bigl[ V(D, G) \bigr] \end{aligned}$$
(1)
$$\begin{aligned} V(D, G) :={} & \mathbb {E}_{\boldsymbol{x} \sim p_{\text{data}}(\boldsymbol{x})} \bigl[ \log D(\boldsymbol{x}) \bigr] \\ & {}+\mathbb {E}_{\boldsymbol{z} \sim p_{\text{prior}}(\boldsymbol{z})} \bigl[\log \bigl(1 - D \bigl(G(\boldsymbol{z}) \bigr) \bigr) \bigr], \end{aligned}$$
(2)
where \(\mathbb {E}\) is the expectation function. The standard GAN approach (Goodfellow et al. 2014) aims at finding a Nash Equilibrium of this objective by using gradient-based techniques in an alternating fashion, sometimes coupled with stabilization techniques (Gulrajani et al. 2017; Roth et al. 2017). As shown in (Goodfellow et al. 2014), for the Bayes-optimal discriminator \(D(\boldsymbol{x})\), the objective in Equation (2) reduces to the Jensen–Shannon divergence between \(p_{\text{data}}\) and the distribution induced by the generator. The work of (Nowozin et al. 2016) later generalized this to a more general class of f-divergences. An alternative formulation proposed in (Arjovsky et al. 2017) uses the Wasserstein-1 distance to measure how different the real and fake samples are. In this work we experimented with both the standard GAN approach as well as Wasserstein GAN. We found both approaches to produce similar results and here present the results for 500 Mpc using Wasserstein-1 distance and 100 Mpc using the standard GAN approach.

3 N-body simulations data

We created N-body simulations of cosmic structures in boxes of size 100 Mpc and 500 Mpc with 5123 and 10243 particles respectively. We used L-PICOLA (Howlett et al. 2015) to create 10 independent simulation boxes for both box sizes. The cosmological model used was ΛCDM (Cold Dark Matter) with Hubble constant \(H_{0}=100\), \(h=70\) km s−1 Mpc−1, dark energy density \(\varOmega_{\varLambda} = 0.72\) and matter density \(\varOmega _{m} = 0.28\). We used the particle distribution at redshift \(z=0\). We cut the boxes into thin slices to create grayscale, two-dimensional images of the cosmic web. This is accomplished by dividing the x-coordinates into uniform intervals to create 1000 segments. We then selected 500 non-consecutive slices and repeated this process for the y and z axes, which gave us 1500 samples from each of the 10 realizations, yielding a total of \(15{,}000\) samples as our training dataset. We pixelised these slices into \(256 \times256\) pixel images. The value at each pixel corresponded to its particle count. After the pixelisation, the images are smoothed with a Gaussian kernel with standard deviation of one pixel. This step is done to decrease the particle shot noise.

Most existing GAN architectures are designed for natural images and therefore require an RGB representation with 3 channels and integer values between 0 and 255. We adapted the DCNN architecture to work on our grayscale, floating-point images. We scaled the image values to lie in the interval \([-1, 1]\) as we empirically found this transformation to improve performance. Once we have trained our GAN model, newly generated samples are transformed back to the original range using an inverse transformation. The transformation between the original, smoothed image x and the scaled image s was chosen to be:
$$ s(x) = \frac{2x}{(x+a)} - 1, $$
(3)
where a is a free parameter. This transformation is non-linear, and similar in nature to a logarithm function. This choice was motivated by the fact, that the cosmic web has a high dynamic range between empty regions of space (voids with no particles) and super-massive halos (with many, concentrated particles). This non-linear transformation enhances the contrast on features of interest, namely the network structure of filaments, sheets and halos. The parameter a allows to control the median value of the images, and was fixed to \(a=4\) throughout the experimental section. Immediately after the generation of a new, synthetic image, we apply the inverse function \(s^{-1}(x)\) to transform it to the original space.

In this paper we used L-PICOLA: a faster, but approximate simulator. For a real application of our method a more precise simulator would be used, such as GADGET-2 (Springel 2005) or PkdGrav3 (Potter et al. 2017). Nevertheless, for the purpose of demonstration of performance of GANs, we consider L-PICOLA simulations to be sufficient. We do not expect the results to differ much if GANs were trained on simulations generated using more precise codes.

4 Implementation and training

We use a slightly modified version of the standard DCGAN architecture (Radford et al. 2015), which was shown to achieve good results on natural images, including various datasets such as LSUN-Bedrooms (3 million indoor bedrooms images) (Yu et al. 2015) or the celebrity face dataset (CelebA, 200000 28 × 28 pixel celebrity faces) (Liu et al. 2015).

Table 1 presents the details of the architecture used for our experiments. We used similar architectures for both the discriminator and the generator, consisting of five convolutional layers. The total number of trainable parameters in both networks is \(3.2 \cdot10^{7}\). We trained the networks until we achieved convergence in terms of the discriminant score for the standard version and a stable distance between the generated and real images for Wasserstein-1.
Table 1

Architecture used in the discriminator and generator networks. We used a batch size of \(m = 16\) samples. The neural network has 32 million trainable parameters. Parameters for our Wasserstein-1 distance implementation are shown in brackets

Layer

Operation

Output

Dimension

Discriminator

X

  

m × 256 × 256 × 1

\(h_{0}\)

conv

LeakyRelu–BatchNorm

m × 128 × 128 × 64

\(h_{1}\)

conv

LeakyRelu–BatchNorm

m × 64 × 64 × 128

\(h_{2}\)

conv

LeakyRelu–BatchNorm

m × 32 × 32 × 256

\(h_{3}\)

conv

LeakyRelu–BatchNorm

m × 16 × 16 × 512

\(h_{4}\)

linear

sigmoid (identity)

m × 1

Generator

z

  

m × 200 (m × 100)

\(h_{0}\)

linear

Relu–BatchNorm

m × 16 × 16 × 512

\(h_{1}\)

deconv

Relu–BatchNorm

m × 32 × 32 × 256

\(h_{2}\)

deconv

Relu–BatchNorm

m × 64 × 64 × 128

\(h_{3}\)

deconv

Relu–BatchNorm

m × 128 × 128 × 64

\(h_{4}\)

deconv

tanh

m × 256 × 256 × 1

A commonly faced problem when training GANs is a phenomenon called mode collapse (Tolstikhin et al. 2017; Metz et al. 2016; Salimans et al. 2016), where the network focuses on a subset of the modes of the underlying data distribution. In these regions where the generator is fooling the discriminator well, the gradient signal becomes weak and the discriminator might be unable to properly lead the generator to the right target distribution. the generator might converge to them, leaving out parts of regions of the target distribution. Wasserstein-1 loss, has some empirical evidence to prevent mode collapse but still suffers from it.

We addressed this problem by doing early stopping, effectively selecting the network parameters during the training process by choosing the network that displayed the best agreement in terms of the power spectrum statistics described in Sect. 5. This happened after 17 and 21 epochs (one epoch consists of one full training cycle over the training set) for the 500 and 100 Mpc images respectively, which took 16.1 and 7 hours on a single GPU Nvidia GTX 1080 with 8 GB. Table 2 presents the set of hyperparameters used in our results.
Table 2

Hyper-parameters used in our GAN implementations. Adam (Kingma et al. 2014) is the algorithm used to estimate the gradient in our models

Hyperparameter

GAN

Description

Standard

Wasserstein-1

Batch size

16

16

Number of training samples used to compute the gradient at each update

z dimension

200

100

Dimension of the gaussian prior distribution

Learning rate D

110−5

110−5

Discriminator learning rate used by the Adam optimizer

\(\beta_{1}\)

0.5

0.5

Exponential decay for the Adam optimizer

\(\beta_{2}\)

0.999

0.999

Exponential decay for the Adam optimizer

Learning rate G

110−5

110−8

Generator learning rate used by the Adam optimizer

Gradient penalty

-

1000

Gradient penalty applied for Wasserstein-1

a

4

4

Parameter in s(x) to obtain the scaled images

5 Diagnostics

The diagnostic measures used in this work are: average histogram of pixel values in the images, average histogram of values of maxima (“peaks”), average auto power spectrum and the average cross-power spectrum of pairs of images within the sample.

Matter density distribution can be described as dimensionless over-density field in space \(\delta(\boldsymbol{x}) = ( \rho( \boldsymbol{x})-\bar{\rho}) / \bar{\rho}\), where \(\rho( \boldsymbol{x})\) is the matter density at position x and ρ̄ is the mean density in the universe. The cross power spectrum \(P_{\delta_{1}\delta_{2}}\) of the matter over-densities is calculated as follows
$$ \bigl\langle \tilde{\delta}_{1}(\boldsymbol{\ell}) \tilde{ \delta}_{2} ^{*}(\boldsymbol{\ell}) \bigr\rangle = (2 \pi)^{2} \delta_{D} \bigl( \boldsymbol{\ell}-\boldsymbol{ \ell}' \bigr) P_{\times}(\ell), $$
(4)
where \(\tilde{\delta}_{1}(\boldsymbol{\ell})\) and \(\tilde{\delta} _{2}(\boldsymbol{\ell})\) are the Fourier transforms of two over-density maps at each logarithmically spaced Fourier bin , and \(\delta_{D}\) is the Dirac delta function. To compute the auto power spectrum, we set \(\tilde{\delta}_{1}(\boldsymbol{\ell})= \tilde{\delta}_{2}(\boldsymbol{\ell})\).

We compute both auto and cross power spectrum from 2D images using a discrete Fourier transform, followed by averaging over angles.

One of the popular alternatives to power spectrum for analysing matter density distribution is the peak statistics. These statistics capture non-Gaussian features present in the cosmic web and are commonly used on weak lensing data (Martinet et al. 2017; Kacprzak et al. 2016). A “peak” is a pixel in the density map that is higher than all its immediate 24 neighbours. The peaks are then counted as a function of their height.

6 Results

We focused our study on two simulation regimes: large-scale distribution, simulated in boxes of size 500 Mpc, and small-scale distribution, with boxes of size 100 Mpc. For both configurations we ran 10 independent simulations. From these boxes, we cut out a total of 15,000 thin, 2D slices for each box size. We design a GAN model where both the discriminator and generator are deep convolutional neural networks. These networks consists of 5 layers, with 4 convolutional layers using filter sizes of \(5 \times5\) pixels.

We trained the model parameters using ADAM, a gradient based optimizer (Kingma et al. 2014), which yields a model that can generate new, random cosmic web images. We assessed the performance of the generative model in several ways. First, we performed a visual comparison of the original and synthetic images. A quantitative assessment of the results was performed based on summary statistics commonly used in cosmology, described in Sect. 5. The angular power spectrum is a standard measure used for describing the matter distribution (Kilbinger 2015). Another important statistic used for cosmological measurements is the distribution of maxima in the density distribution, often called “peak statistics” (Dietrich and Hartlap 2010; Kacprzak et al. 2016). This statistic compares the number of maxima in the maps as a function of their values. We also assessed the statistical independence of samples generated by GANs, as real cosmic structures are expected to be independent due to isotropy and homogeneity of the universe, unless they are physically close to each other. To assess the independence of generated cosmic web distributions, we compare the cross-correlations between pairs of images. Another statistic we used was the histogram of pixel values of N-body and GAN-generated images. Finally, we calculated the covariance between the power spectrum values at different k.

6.1 Large images of size 500 Mpc

Figure 1 presents the original images (top) and synthesized images (bottom), for the 500 Mpc simulations. The plotted images were transformed using Equation (3) to make it easier to assess the difference in the texture. The cosmic web structure produced by the GAN model is visually very difficult to distinguish from the originals, even for human experts. The GAN can capture the prominent features in this data, including halos and filaments.
Figure 1
Figure 1

Samples from N-body simulation and from GAN for the box size of 500 Mpc. Note that the transformation in Equation (3) with \(a=20\) was applied to the images shown above for better clarity

Figure 2 shows the summary statistics for the original (blue lines) and GAN-synthesized (red lines) samples for 500 Mpc images. Mass density histograms, shown in the top left panel, agree well throughout most of the range, except for very large densities. Peak statistics, shown in top right panel, also agree well, although slightly worse than the density histograms, especially for higher mass ranges, where the error can reach 10%. The power spectrum is shown in the bottom left panel. We focused on correlations at angular scales larger than a few Mpc, as the current N-body simulations do not agree well in their predictions for smaller scales (Schneider et al. 2016). We find that between \(k=0.06\) and \(k=0.4\) the agreement is 1–2%, while the rest of the range agrees within 15%, and for large \(k>0.8\), the error starts to increase dramatically. Finally, the bottom right panels show the average cross power spectra, with the coloured bands corresponding to the standard deviation calculated using all available image pairs. As expected, the cross power spectrum of the original images is close to zero. We do not find evident discrepancies in the cross power spectrum between pairs consisting of N-body- and GAN-generated image, as well as between pairs of GAN-generated images. This indicates that the generated images can be also considered as uncorrelated realisations of cosmic web. While the lack of cross correlation does not strictly imply independence, it assures that local structures are not consistently the same, and the data is not simply memorised and “pasted” in the same locations. Finally, the correlation matrix of power spectra at different values of k is shown in the top panels of Fig. 3. For the 500 Mpc images, the structure of the correlation matrix for GAN is similar to N-body: more correlation is observed at small scales. The numerical agreement, however, is good only for small scales, with 5% differences. For large scales, the errors reach 20%.
Figure 2
Figure 2

Comparison of summary statistics between N-body and GAN simulations, for box size of 500 Mpc. The statistics are: mass density histogram (upper left), peak count (upper right), power spectrum of 2D images (lower left) and cross power spectrum (lower right). The cross power spectrum is calculated between pairs N-body images (blue points), between pairs of GAN images (red points), and between pairs consisting of one GAN and one N-body image (cyan points). The power spectra are shown in units of \(h^{-1}\) Mpc, where \(h= \mathrm{H}_{0}/100\) corresponds to the Hubble parameter. The standard errors on the mean of the shown with a shaded region, and are too small to be seen for the first three panels

Figure 3
Figure 3

Correlation matrix of \(P(k)\) values from multiple images. The correlation of the N-body and GAN-generated images is shown on the left and right panels, respectively. Top panels show the correlation for 500 Mpc images, and bottom panels for 100 Mpc

6.2 Small images of size 100 Mpc

The example density distributions from 100 Mpc data is shown in Fig. 4. These images are less homogeneous than the ones of size 500 Mpc. The structures present in smaller images can vary from image to image: some may contain only empty space while some might be large structures. The agreement between the real and GAN-generated images is still good, although it is possible to distinguish them visually. Notably, the filaments do not look as distinct as in the real images. Even thought the images are not homogeneous, the network can still capture this variability: it does generate images full of structures, as well as rather empty ones. However, the proportions of these types of distributions among the generated samples may differ between real and GAN data. These differences will manifest themselves in the quantitative comparison.
Figure 4
Figure 4

Samples from N-body simulation and from GAN for the box size of 100 Mpc. In this figure, transformation in Equation (3) with \(a=7\) was applied

Figure 5 shows the summary statistics for 100 Mpc images. The agreement between mass density histograms is good. The difference in terms of peak statistics is on average small, although with deviations of 10% in the middle of the mass range. The error on the power spectrum is much larger: between \(k=0.13\) and \(k=4\) there is a 20% disagreement, and reaches 30% outside that range. From from \(k>5\) the error becomes large. Similarly to 500 Mpc images, we do not observe large discrepancies in the cross power spectrum between pairs of GAN generated images, as well as between GAN-real pairs. The agreement between the correlation matrix of the power spectra between N-body and GAN-generated is much better for 100 Mpc images. The differences are smaller than 5% for most of the correlation matrix, as shown in the bottom panels in Fig. 3.
Figure 5
Figure 5

Comparison of summary statistics between N-body and GAN simulations, for a box size of 100 Mpc. The statistics are the same as in Fig. 2

7 Conclusion

We demonstrated the ability of Generative Adversarial Models to learn the distribution describing the complex structures of the cosmic web. We implemented a generative model based on deep convolutional neural networks, trained it on 2D images of cosmic web produced from N-body simulations, and used it to generate a synthetic cosmic web. Our GAN-generated images are visually very similar to the ones from N-body simulations: the generative model managed to capture the complex structures of halos, filaments and voids. We compared the GAN-generated images to the N-body originals using several summary statistics and found a good agreement. Most notably, for 500 Mpc, the power agreement on power spectrum was very good: between \(k=0.06\) and \(k=0.4\) the level of 1–2% is close to the requirements for precision cosmology (Schneider et al. 2016). The correlation matrices of \(P(k)\) values had similar structures and agreed to around 5% at small scales, but the GANs did not reproduce the large scale correlations well, with 20% difference. While more work would be needed to improve this agreement further, this result is promising for using GANs as emulators of mass density distributions for practical applications.

For 100 Mpc images the error on the power spectrum was larger, reaching 20%. We attribute this feature to the fact that images in the 100 Mpc sample are much more inhomogeneous than the 500 Mpc sample: some images contain dense regions with halos, and some relatively empty regions with few features. We have seen empirically that this tends to induce a known phenomenon in GANs called mode collapse, where the training algorithm focuses on a subset of the target distribution. This results in the model generating a few specific types of images, for example the ones with empty regions, more often than others. We conclude that the application of GANs is suitable for large, homogeneous datasets. For the type of inhomogeneous distributions appearing in the 100 Mpc sample, some techniques addressing mode-collapse (Srivastava et al. 2017; Grnarova et al. 2017) might be required if high-quality statistics are required.

An important advantage of the approach we presented here is that, once trained, it generates new samples in a fraction of a second on a modern Graphics Processing Unit (GPU). Compared to a classical N-body technique, this constitutes a gain of several orders of magnitude in terms of simulation time. The availability of this approach has the potential to dramatically reduce the computational burden required to acquire the data needed for most cosmological analyses. Examples of such analyses include the computation of covariance matrices for cosmology with large scale structure (Harnois-Déraps and van Waerbeke 2015) or analyses using weak lensing shear peak statistics (Dietrich and Hartlap 2010). Generative methods may become even more important in the future; the need for fast N-body simulations is anticipated to grow in the era of large cosmological datasets obtained by the Euclid1 and LSST2 projects. The need for fast simulations will be amplified further by the emergence of new analysis methods, which can be based on advanced statistics (Petri et al. 2013) or deep learning (Schmelzle et al. 2017). These methods aim to extract more information from cosmological data and often use large simulation datasets. While we demonstrated the performance of GANs for 2D images using training on a single GPU, this approach can naturally be extended to generate 3D mass distributions (Ravanbakhsh et al. 2016) for estimating cosmological parameters from dark matter simulations.

Finally, it would be interesting to explore how many simulations are needed to train a GAN model for a given precision requirement. Another future direction would be to further explore the agreement between the original and GAN-generated images in terms of advanced statistics, such as for example 3-pt functions or Minkowski functionals. Going beyond the cross-correlations to further tests for independence of the GAN-generated samples could also be of interest. We leave this exploration to future work.

Declarations

Acknowledgements

We acknowledge the support of the IT service of the Leonhard and Euler clusters at ETH Zurich.

Availability of data and materials

The data that support the findings of this study are available from the corresponding author upon reasonable request.

Funding

This work was support in part by grant number 200021_169130 from the Swiss National Science Foundation. The funding body had no involvement in the design of the study, collection, analysis, and interpretation of data, or writing the manuscript.

Authors’ contributions

AR performed the experiment design and the full analysis. TK and AL performed the experiment design and provided direct guidance and supervision. JF and RS prepared the N-body simulations dataset. AA, AR and TH provided guidance, supervision and resources necessary to faciliate the project. All authors read and approved the final manuscript.

Competing interests

The authors declare that they have no competing interests.

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Authors’ Affiliations

(1)
Photogrammetry & Remote Sensing, ETH Zurich, Zurich, Switzerland
(2)
Institute for Particle Physics and Astrophysics, ETH Zurich, Zurich, Switzerland
(3)
Department of Computer Science, ETH Zurich, Zurich, Switzerland

References

  1. Arjovsky, M., Chintala, S., Bottou, L.: Wasserstein generative adversarial networks. In: Precup, D., Teh, Y.W. (eds.) Proceedings of the 34th International Conference on Machine Learning. Proceedings of Machine Learning Research, vol. 70, pp. 214–223. PMLR, Sydney (2017) Google Scholar
  2. Bond, J.R., Kofman, L., Pogosyan, D.: How filaments of galaxies are woven into the cosmic web. Nature 380, 603–606 (1996) arXiv:astro-ph/9512141. https://doi.org/10.1038/380603a0 ADSView ArticleGoogle Scholar
  3. Boylan-Kolchin, M., Springel, V., White, S.D.M., Jenkins, A., Lemson, G.: Resolving cosmic structure formation with the Millennium-II simulation. Mon. Not. R. Astron. Soc. 398, 1150–1164 (2009) arXiv:0903.3041. https://doi.org/10.1111/j.1365-2966.2009.15191.x ADSView ArticleGoogle Scholar
  4. Busha, M.T., Wechsler, R.H., Becker, M.R., Erickson, B., Evrard, A.E.: Catalog production for the DES blind cosmology challenge. In: American Astronomical Society Meeting Abstracts, vol. 221, pp. 341.07 (2013) Google Scholar
  5. Coles, P., Chiang, L.-Y.: Characterizing the nonlinear growth of large-scale structure in the universe. Nature 406, 376–378 (2000) arXiv:astro-ph/0006017. https://doi.org/10.1038/35019009 ADSView ArticleGoogle Scholar
  6. DES Collaboration: dark energy survey year 1 results: cosmological constraints from galaxy clustering and weak lensing (2017). arXiv:1708.01530
  7. Dietrich, J.P., Hartlap, J.: Cosmology with the shear-peak statistics. Mon. Not. R. Astron. Soc. 402, 1049–1058 (2010). arXiv:0906.3512. https://doi.org/10.1111/j.1365-2966.2009.15948.x ADSView ArticleGoogle Scholar
  8. Dietrich, J.P., Werner, N., Clowe, D., Finoguenov, A., Kitching, T., Miller, L., Simionescu, A.: A filament of dark matter between two clusters of galaxies. Nature 487, 202–204 (2012) arXiv:1207.0809. https://doi.org/10.1038/nature11224 ADSView ArticleGoogle Scholar
  9. Forero-Romero, J.E., Hoffman, Y., Gottlöber, S., Klypin, A., Yepes, G.: A dynamical classification of the cosmic web. Mon. Not. R. Astron. Soc. 396, 1815–1824 (2009). arXiv:0809.4135. https://doi.org/10.1111/j.1365-2966.2009.14885.x ADSView ArticleGoogle Scholar
  10. Fosalba, P., Gaztañaga, E., Castander, F.J., Crocce, M.: The MICE grand challenge light-cone simulation—III. Galaxy lensing mocks from all-sky lensing maps. Mon. Not. R. Astron. Soc. 447, 1319–1332 (2015) arXiv:1312.2947. https://doi.org/10.1093/mnras/stu2464 ADSView ArticleGoogle Scholar
  11. Goodfellow, I.J., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., Bengio, Y.: Generative adversarial networks (2014). arXiv:1406.2661
  12. Grnarova, P., Levy, K.Y., Lucchi, A., Hofmann, T., Krause, A.: An online learning approach to generative adversarial networks (2017). arXiv preprint. arXiv:1706.03269
  13. Gulrajani, I., Ahmed, F., Arjovsky, M., Dumoulin, V., Courville, A.: Improved training of Wasserstein GANs (2017). arXiv:1704.00028
  14. Gupta, A., Zorrilla Matilla, J.M., Hsu, D., Haiman, Z.: Non-Gaussian information from weak lensing data via deep learning (2018). arXiv:1802.01212
  15. Harnois-Déraps, J., Vafaei, S., Van Waerbeke, L.: Gravitational lensing simulations—I. Covariance matrices and halo catalogues. Mon. Not. R. Astron. Soc. 426, 1262–1279 (2012) arXiv:1202.2332. https://doi.org/10.1111/j.1365-2966.2012.21624.x ADSView ArticleGoogle Scholar
  16. Harnois-Déraps, J., van Waerbeke, L.: Simulations of weak gravitational lensing—II. Including finite support effects in cosmic shear covariance matrices. Mon. Not. R. Astron. Soc. 450, 2857–2873 (2015) arXiv:1406.0543. https://doi.org/10.1093/mnras/stv794 ADSView ArticleGoogle Scholar
  17. Heitmann, K., Higdon, D., White, M., Habib, S., Williams, B.J., Lawrence, E., Wagner, C.: The coyote universe. II. Cosmological models and precision emulation of the nonlinear matter power spectrum. Acad. Publ. J. 705, 156–174 (2009b) arXiv:0902.0429. https://doi.org/10.1088/0004-637X/705/1/156 View ArticleGoogle Scholar
  18. Heitmann, K., White, M., Wagner, C., Habib, S., Higdon, D.: The coyote universe. I. Precision determination of the nonlinear matter power spectrum. Acad. Publ. J. 715, 104–121 (2010a) arXiv:0812.1052. https://doi.org/10.1088/0004-637X/715/1/104 View ArticleGoogle Scholar
  19. Hildebrandt, H., Viola, M., Heymans, C., Joudaki, S., Kuijken, K., Blake, C., Erben, T., Joachimi, B., Klaes, D., Miller, L., et al.: Kids-450: cosmological parameter constraints from tomographic weak gravitational lensing. Mon. Not. R. Astron. Soc. 465(2), 1454–1498 (2017) ADSView ArticleGoogle Scholar
  20. Howlett, C., Manera, M., Percival, W.J.: L-PICOLA: a parallel code for fast dark matter simulation. Astron. Comput. 12, 109–126 (2015) arXiv:1506.03737. https://doi.org/10.1016/j.ascom.2015.07.003 ADSView ArticleGoogle Scholar
  21. Joudaki, S., Mead, A., Blake, C., Choi, A., de Jong, J., Erben, T., Fenech Conti, I., Herbonnet, R., Heymans, C., Hildebrandt, H., Hoekstra, H., Joachimi, B., Klaes, D., Köhlinger, F., Kuijken, K., McFarland, J., Miller, L., Schneider, P., Viola, M.: KiDS-450: testing extensions to the standard cosmological model. Mon. Not. R. Astron. Soc. 471, 1259–1279 (2017) arXiv:1610.04606. https://doi.org/10.1093/mnras/stx998 ADSView ArticleGoogle Scholar
  22. Kacprzak, T., Kirk, D., Friedrich, O., Amara, A., Refregier, A., Marian, L., Dietrich, J., Suchyta, E., Aleksić, J., Bacon, D., et al.: Cosmology constraints from shear peak statistics in dark energy survey science verification data. Mon. Not. R. Astron. Soc. 463(4), 3653–3673 (2016) ADSView ArticleGoogle Scholar
  23. Kilbinger, M.: Cosmology with cosmic shear observations: a review. Rep. Prog. Phys. 78(8), 086901 (2015) arXiv:1411.0115. https://doi.org/10.1088/0034-4885/78/8/086901 ADSMathSciNetView ArticleGoogle Scholar
  24. Kingma, D.P., Ba, J., Adam: A method for stochastic optimization (2014) CoRR. arXiv:1412.6980
  25. Kingma, D.P., Welling, M.: Auto-encoding variational Bayes. In: The International Conference on Learning Representations (ICLR), Banff (2014) arXiv:1312.6114 Google Scholar
  26. Krizhevsky, A., Sutskever, I., Hinton, G.E.: Imagenet classification with deep convolutional neural networks. In: Advances in Neural Information Processing Systems, pp. 1097–1105 (2012) Google Scholar
  27. Lawrence, E., Heitmann, K., White, M., Higdon, D., Wagner, C., Habib, S., Williams, B.: The coyote universe. III. Simulation suite and precision emulator for the nonlinear matter power spectrum. Acad. Publ. J. 713, 1322–1331 (2010) arXiv:0912.4490. https://doi.org/10.1088/0004-637X/713/2/1322 View ArticleGoogle Scholar
  28. Libeskind, N.I., van de Weygaert, R., Cautun, M., Falck, B., Tempel, E., Abel, T., Alpaslan, M., Aragoon-Calvo, M.A., Forero-Romero, J.E., Gonzalez, R., Gottloober, S., Hahn, O., Hellwing, W.A., Hoffman, Y., Jones, B.J.T., Kitaura, F., Knebe, A., Manti, S., Neyrinck, M., Nuza, S.E., Padilla, N., Platen, E., Ramachandra, N., Robotham, A., Saar, E., Shandarin, S., Steinmetz, M., Stoica, R.S., Sousbie, T., Yepes, G.: Tracing the cosmic web (2017). arXiv:1705.03021
  29. Lin, C.-A., Kilbinger, M.: A new model to predict weak-lensing peak counts. I. Comparison with N-body simulations. Astron. Astrophys. 576, 24 (2015) arXiv:1410.6955. https://doi.org/10.1051/0004-6361/201425188 View ArticleGoogle Scholar
  30. Liu, Z., Luo, P., Wang, X., Tang, X.: Deep learning face attributes in the wild. In: Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738 (2015) Google Scholar
  31. Martinet, N., Schneider, P., Hildebrandt, H., Shan, H., Asgari, M., Dietrich, J.P., Harnois-Déraps, J., Erben, T., Grado, A., Heymans, C., Hoekstra, H., Klaes, D., Kuijken, K., Merten, J., Nakajima, R.: KiDS-450: cosmological constraints from weak-lensing peak statistics—II: inference from shear peaks using N-body simulations. Mon. Not. R. Astron. Soc. 474, 712–730 (2018). arXiv:1709.07678. https://doi.org/10.1093/mnras/stx2793 ADSView ArticleGoogle Scholar
  32. Martinet, N., Schneider, P., Hildebrandt, H., Shan, H., Asgari, M., Dietrich, J.P., Harnois-Déraps, J., Erben, T., Grado, A., Heymans, C., Hoekstra, H., Klaes, D., Kuijken, K., Merten, J., Nakajima, R.: KiDS-450: cosmological Constraints from Weak Lensing Peak Statistics—II: inference from Shear Peaks using N-body Simulations (2017). arXiv:1709.07678
  33. Metz, L., Poole, B., Pfau, D., Sohl-Dickstein, J.: Unrolled generative adversarial networks (2016). arXiv:1611.02163
  34. Mustafa, M., Bard, D., Bhimji, W., Al-Rfou, R., Lukić, Z.: Creating virtual universes using generative adversarial networks (2017). arXiv:1706.02390
  35. Nowozin, S., Cseke, B., Tomioka, R.: f-gan: training generative neural samplers using variational divergence minimization. In: Advances in Neural Information Processing Systems, vol. 29, pp. 271–279. Curran Associates, Red Hook (2016) Google Scholar
  36. Petri, A., Haiman, Z., Hui, L., May, M., Kratochvil, J.M.: Cosmology with Minkowski functionals and moments of the weak lensing convergence field. Phys. Rev. D 88(12), 123002 (2013) arXiv:1309.4460. https://doi.org/10.1103/PhysRevD.88.123002 ADSView ArticleGoogle Scholar
  37. Potter, D., Stadel, J., Teyssier, R.: Pkdgrav3: beyond trillion particle cosmological simulations for the next era of galaxy surveys. Comput. Astrophys. Cosmol. 4(1), 2 (2017). https://doi.org/10.1186/s40668-017-0021-1 ADSView ArticleGoogle Scholar
  38. Radford, A., Metz, L., Chintala, S.: Unsupervised representation learning with deep convolutional generative adversarial networks (2015). arXiv:1511.06434
  39. Ravanbakhsh, S., Lanusse, F., Mandelbaum, R., Schneider, J.G., Poczos, B.: Enabling dark energy science with deep generative models of galaxy images. In: AAAI, pp. 1488–1494 (2017) Google Scholar
  40. Ravanbakhsh, S., Oliva, J., Fromenteau, S., Price, L., Ho, S., Schneider, J., Póczos, B.: Estimating cosmological parameters from the dark matter distribution. In: International Conference on Machine Learning, pp. 2407–2416 (2016) Google Scholar
  41. Refregier, A.: Weak gravitational lensing by large-scale structure. Annu. Rev. Astron. Astrophys. 41, 645–668 (2003) arXiv:astro-ph/0307212. https://doi.org/10.1146/annurev.astro.41.111302.102207 ADSView ArticleGoogle Scholar
  42. Regier, J., McAuliffe, J., Prabhat, M.: A deep generative model for astronomical images of galaxies. In: NIPS Workshop: Advances in Approximate Bayesian Inference (2015) Google Scholar
  43. Roth, K., Lucchi, A., Nowozin, S., Hofmann, T.: Stabilizing training of generative adversarial networks through regularization. In: Advances in Neural Information Processing Systems, vol. 30, pp. 2018–2028. Curran Associates, Red Hook (2017) Google Scholar
  44. Salimans, T., Goodfellow, I., Zaremba, W., Cheung, V., Radford, A., Chen, X.: Improved techniques for training gans. In: Advances in Neural Information Processing Systems, vol. 29, pp. 2234–2242. Curran Associates, Red Hook (2016) Google Scholar
  45. Schawinski, K., Zhang, C., Zhang, H., Fowler, L., Santhanam, G.K.: Generative adversarial networks recover features in astrophysical images of galaxies beyond the deconvolution limit. Mon. Not. R. Astron. Soc. 467, 110–114 (2017) arXiv:1702.00403. https://doi.org/10.1093/mnrasl/slx008 ADSView ArticleGoogle Scholar
  46. Schmelzle, J., Lucchi, A., Kacprzak, T., Amara, A., Sgier, R., Réfrégier, A., Hofmann, T.: Cosmological model discrimination with Deep Learning (2017). arXiv:1707.05167
  47. Schneider, A., Teyssier, R., Potter, D., Stadel, J., Onions, J., Reed, D.S., Smith, R.E., Springel, V., Pearce, F.R., Scoccimarro, R.: Matter power spectrum and the challenge of percent accuracy. J. Cosmol. Astropart. Phys. 4, 047 (2016) arXiv:1503.05920. https://doi.org/10.1088/1475-7516/2016/04/047 ADSView ArticleGoogle Scholar
  48. Sgier, R., Réfrégier, A., Amara, A., Nicola, A.: Fast generation of covariance matrices for weak lensing (2018). arXiv:1801.05745
  49. Springel, V.: The cosmological simulation code GADGET-2. Mon. Not. R. Astron. Soc. 364, 1105–1134 (2005) arXiv:astro-ph/0505010. https://doi.org/10.1111/j.1365-2966.2005.09655.x ADSView ArticleGoogle Scholar
  50. Srivastava, A., Valkoz, L., Russell, C., Gutmann, M.U., Sutton, C.: Veegan: reducing mode collapse in gans using implicit variational learning. In: Advances in Neural Information Processing Systems, pp. 3308–3318 (2017) Google Scholar
  51. Teyssier, R., Pires, S., Prunet, S., Aubert, D., Pichon, C., Amara, A., Benabed, K., Colombi, S., Refregier, A., Starck, J.-L.: Full-sky weak-lensing simulation with 70 billion particles. Astron. Astrophys. 497, 335–341 (2009). arXiv:0807.3651. https://doi.org/10.1051/0004-6361/200810657 ADSView ArticleGoogle Scholar
  52. Tolstikhin, I., Gelly, S., Bousquet, O., Simon-Gabriel, C.-J., Schölkopf, B.: AdaGAN: boosting Generative Models (2017). arXiv:1701.02386
  53. Yu, F., Zhang, Y., Song, S., Seff, A., Xiao, J.: LSUN: construction of a large-scale image dataset using deep learning with humans in the loop. CoRR (2015). arXiv:1506.03365

Copyright

© The Author(s) 2018

Advertisement