This thesis breaks new ground in supernova type Ia cosmology, developing novel and powerful machine-learning methods scalable to the next generation of astronomical surveys. It demonstrates the feasibility of a fully simulation-based approach to inference, which overcomes the limitations of current methods while increasing the efficiency (and speed) of cosmological inference by orders of magnitude from upcoming large samples of objects. Combining advances in machine learning, numerical modelling, and physical insight, this work provides a much-needed bridge between cosmology and data science. On top of its exceptional methodological impact, the thesis itself is an outstanding product: it is written to the highest scientific and editorial standard, with exceptional quality of figures and graphs, and demonstrating superb command of statistics, machine learning, astrophysics, and cosmology. It is a precious resource for anybody interested in learning, in a concise and accessible yet rigorous manner, the state-of-the-art in supernova type Ia cosmology and modern inference methodologies in general.