Variable stars with well-calibrated period–luminosity (PL) relationships provide accurate distance measurements to nearby galaxies and are therefore a vital tool for cosmology and astrophysics. While these measurements typically rely on samples of Cepheid and RR-Lyrae stars, abundant populations of luminous variable stars with longer periods of 10–1000 d remain largely unused. We apply machine learning to derive a mapping between light-curve features of these variable stars and their magnitude to extend the traditional PL relation commonly used for Cepheid samples. Using photometric data for long-period variable stars in the Large Magellanic Cloud (LMC), we demonstrate that our predictions produce residual errors comparable to those obtained on the corresponding Cepheid population. We show that our model generalizes well to other samples by performing a blind test on photometric data from the Small Magellanic Cloud (SMC). Our predictions on the SMC again show small residual errors and biases, comparable to results that employ PL relations fitted on Cepheid samples. The residual biases are complementary between the long-period variable and Cepheid fits, which provides exciting prospects to better control sources of systematic error in cosmological distance measurements. We finally show that the proposed methodology can be used to optimize samples of variable stars as standard candles independent of any prior variable star classification.