  To fully take advantage of the data provided by large-scale structure
surveys, we need to quantify the potential impact of baryonic effects, such as
feedback from active galactic nuclei (AGN) and star formation, on cosmological
observables. In simulations, feedback processes originate on scales that remain
unresolved. Therefore, they need to be sourced via subgrid models that contain
free parameters. We use machine learning to calibrate the AGN and stellar
feedback models for the FLAMINGO cosmological hydrodynamical simulations. Using
Gaussian process emulators trained on Latin hypercubes of 32 smaller-volume
simulations, we model how the galaxy stellar mass function and cluster gas
fractions change as a function of the subgrid parameters. The emulators are
then fit to observational data, allowing for the inclusion of potential
observational biases. We apply our method to the three different FLAMINGO
resolutions, spanning a factor of 64 in particle mass, recovering the observed
relations within the respective resolved mass ranges. We also use the
emulators, which link changes in subgrid parameters to changes in observables,
to find models that skirt or exceed the observationally allowed range for
cluster gas fractions and the stellar mass function. Our method enables us to
define model variations in terms of the data that they are calibrated to rather
than the values of specific subgrid parameters. This approach is useful,
because subgrid parameters are typically not directly linked to particular
observables, and predictions for a specific observable are influenced by
multiple subgrid parameters.
