  The applications of artificial neural networks in the cosmological field have
shone successfully during the past decade, this is due to their great ability
of modeling large amounts of datasets and complex nonlinear functions. However,
in some cases, their use still remains controversial because their ease of
producing inaccurate results when the hyperparameters are not carefully
selected. In this paper, to find the optimal combination of hyperparameters to
artificial neural networks, we propose to take advantage of the genetic
algorithms. As a proof of the concept, we analyze three different cosmological
cases to test the performance of the architectures achieved with the genetic
algorithms and compare them with the standard process, consisting of a grid
with all possible configurations. First, we carry out a model-independent
reconstruction of the distance modulus using a type Ia supernovae compilation.
Second, the neural networks learn to infer the equation of state for the
quintessence model, and finally with the data from a combined redshift catalog
the neural networks predict the photometric redshift given six photometric
bands (urgizy). We found that the genetic algorithms improve considerably the
generation of the neural network architectures, which can ensure more
confidence in their physical results because of the better performance in the
metrics with respect to the grid method.
