  The baryon acoustic oscillations (BAO) have proven to be an invaluable tool
in constraining the expansion history of the Universe at late times and are
characterized by the comoving sound horizon at the baryon drag epoch
$r_\mathrm{s}(z_\mathrm{d})$. The latter quantity can be calculated either
numerically using recombination codes or via fitting functions, such as the one
by Eisenstein and Hu (EH), made via grids of parameters of the recombination
history. Here we quantify the accuracy of these expressions and show that they
can strongly bias the derived constraints on the cosmological parameters using
BAO data. Then, using a machine learning approach, called the genetic
algorithms, we proceed to derive new analytic expressions for
$r_\mathrm{s}(z_\mathrm{d})$ which are accurate at the $\sim0.003\%$ level in a
range of $10\sigma$ around the Planck 2018 best-fit or $\sim0.018\%$ in a much
broader range, compared to $\sim 2-4\%$ for the EH expression, thus obtaining
an improvement of two to three orders of magnitude. Moreover, we also provide
fits that include the effects of massive neutrinos and an extension to the
concordance cosmological model assuming variations of the fine structure
constant. Finally, we note that our expressions can be used to ease the
computational cost required to compute $r_\mathrm{s}(z_\mathrm{d})$ with a
Boltzmann code when deriving cosmological constraints using BAO data from
current and upcoming surveys.
