Machine learning coarse-grained potentials of protein thermodynamics