Predicting countries’ energy consumption and pollution levels precisely from socioeconomic drivers will be essential to support sustainable policy-making in an effective manner. Current predictive models, like the widely used STIRPAT equation, are based on rigid mathematical expressions that assume constant elasticities. Using a Bayesian approach to symbolic regression, here we explore a vast amount of suitable mathematical expressions to model the link between energy-related impacts and socioeconomic drivers. We find closed-form analytical expressions that outperform the well-established STIRPAT equation and whose mathematical structure challenges the assumption of constant elasticities adopted in the literature. Our work unfolds new avenues to apply machine learning algorithms to derive analytical expressions from data in environmental studies, which could help find better models and solutions in energy-related problems.