Heterogeneities in structure and polarization have been employed to enhance the energy storage properties of ferroelectric films. The presence of nonpolar phases, however, weakens the net polarization. Here, we achieve a slush-like polar state with fine domains of different ferroelectric polar phases by narrowing the large combinatorial space of likely candidates using machine learning methods. The formation of the slush-like polar state at the nanoscale in cation-doped BaTiO3 films is simulated by phase field simulation and confirmed by aberration-corrected scanning transmission electron microscopy. The large polarization and the delayed polarization saturation lead to greatly enhanced energy density of 80 J/cm3 and transfer efficiency of 85% over a wide temperature range. Such a data-driven design recipe for a slush-like polar state is generally applicable to quickly optimize functionalities of ferroelectric materials.