The temperature and pressure dependence of structural phase transitions determine the structure-functionality relationships in many technologically important materials. Harmonic Hamiltonians have proven successful in predicting the vibrational properties of many materials. However, they are inadequate for modeling structural phase transitions in crystals with potential energy surfaces that are either strongly anharmonic or nonconvex with respect to collective atomic displacements or homogeneous strains. In this paper we develop a framework to express highly anharmonic first-principles potential energy surfaces as polynomials of collective cluster deformations. We further adapt the approach to a nonlinear extension of the cluster expansion formalism through the use of an artificial neural net model. The machine learning models are trained on a large database of first-principles calculations and are shown to reproduce the potential energy surface with low error.