  Over the last few years, many studies have found an empirical relationship
between the abundance of a star and its age. Here we estimate spectroscopic
stellar ages for 178 825 red-giant stars observed by the APOGEE survey with a
median statistical uncertainty of 17%. To this end, we use the supervised
machine learning technique XGBoost, trained on a high-quality dataset of 3060
red-giant and red-clump stars with asteroseismic ages observed by both APOGEE
and Kepler. After verifying the obtained age estimates with independent
catalogues, we investigate some of the classical chemical, positional, and
kinematic relationships of the stars as a function of their age. We find a very
clear imprint of the outer-disc flare in the age maps and confirm the recently
found split in the local age-metallicity relation. We present new and precise
measurements of the Galactic radial metallicity gradient in small age bins
between 0.5 and 12 Gyr, confirming a steeper metallicity gradient for $\sim2-5$
Gyr old populations and a subsequent flattening for older populations mostly
produced by radial migration. In addition, we analyse the dispersion about the
abundance gradient as a function of age. We find a clear power-law trend (with
an exponent $\beta\approx0.15$) for this relation, indicating a relatively
smooth radial migration history in the Galactic disc over the past $7-9$ Gyr.
Departures from this power law may possibly be related to the Gaia Enceladus
merger and passages of the Sagittarius dSph galaxy. Finally, we confirm
previous measurements showing a steepening in the age-velocity dispersion
relation at around $\sim9$ Gyr, but now extending it over a large extent of the
Galactic disc (5 kpc $<R_{\rm Gal}<13$ kpc). [Abridged]
