In this work, we model the spectra of wall-pressure fluctuations beneath subsonic, supersonic and hypersonic turbulent boundary layers (TBLs) at zero pressure gradient using neural networks (NNs). We collect and compile data pertaining to wall-pressure fluctuation spectra from several experimental and computational studies on TBLs. In contrast to conventional methods of hand-tuning the parameters of a model to fit the available data, the use of modern powerful statistical learning techniques such as neural networks provide an automatic and quick way to fit a model. We explore four different scenarios of making use of the compiled data. In comparison with COMPRA-G, an empirical model recently proposed to account for compressibility effects in TBLs, we achieve a better fit to observed data using the NN model, particularly at low frequencies of the spectra.