  The 21-cm signal of neutral hydrogen is a sensitive probe of the Epoch of
Reionization (EoR) and Cosmic Dawn. Currently operating radio telescopes have
ushered in a data-driven era of 21-cm cosmology, providing the first
constraints on the astrophysical properties of sources that drive this signal.
However, extracting astrophysical information from the data is highly
non-trivial and requires the rapid generation of theoretical templates over a
wide range of astrophysical parameters. To this end emulators are often
employed, with previous efforts focused on predicting the power spectrum. In
this work we introduce 21cmGEM - the first emulator of the global 21-cm signal
from Cosmic Dawn and the EoR. The smoothness of the output signal is guaranteed
by design. We train neural networks to predict the cosmological signal using a
database of ~30,000 simulated signals which were created by varying seven
astrophysical parameters: the star formation efficiency and the minimal mass of
star-forming halos; the efficiency of the first X-ray sources and their
spectrum parameterized by spectral index and the low energy cutoff; the mean
free path of ionizing photons and the CMB optical depth. We test the
performance with a set of ~2,000 simulated signals, showing that the relative
error in the prediction has an r.m.s. of 0.0159. The algorithm is efficient,
with a running time per parameter set of 0.16 sec. Finally, we use the database
of models to check the robustness of relations between the features of the
global signal and the astrophysical parameters that we previously reported.
