Machine learning universal bosonic functionals