  Context: The effective temperature is a key parameter governing the
properties of a star. For stellar chemistry, it has the strongest impact on the
accuracy of the abundances derived. Since Cepheids are pulsating stars,
determining their effective temperature is more complicated that in the case of
non-variable stars. Aims: We want to provide a new temperature scale for
classical Cepheids, with a high precision and full control of the systematics.
Methods: Using a data-driven machine learning technique employing observed
spectra, and taking great care to accurately phase single-epoch observations,
we have tied flux ratios to (label) temperatures derived using the infrared
surface brightness method. Results: We identified 143 flux ratios that allow us
to determine the effective temperature with a precision of a few K and an
accuracy better than 150 K, which is in line with the most accurate temperature
measures available to date. The method does not require a normalization of the
input spectra and provides homogeneous temperatures for low- and
high-resolution spectra, even at the lowest signal-to-noise ratios. Due to the
lack of a dataset of sufficient sample size for Small Magellanic Cloud
Cepheids, the temperature scale does not extend to Cepheids with [Fe/H] < -0.6
dex but nevertheless provides an exquisite, homogeneous means of characterizing
Galactic and Large Magellanic Cloud Cepheids. Conclusions: The temperature
scale will be extremely useful in the context of spectroscopic surveys for
Milky Way archaeology with the WEAVE and 4MOST spectrographs. It paves the way
for highly accurate and precise metallicity estimates, which will allow us to
assess the possible metallicity dependence of Cepheids' period-luminosity
relations and, in turn, to improve our measurement of the Hubble constant H0.
