Understanding the function of real materials in heterogeneous system, such as magnetic domain and metallographic structure, has been a outstanding issue in materials science. Thus the development of a consistent and fast analysis method that consider the defects, roughness, crystal sizes, etc. is utmost important. Here we are developing a machine learning-based formula that can treats the microscopic morphology and describes the macroscopic properties based on the energy of the system. One interesting application is to describe the coercivity based on the structure and micromagnetic properties. The Landau free energy theory is very hard to be implemented in complex applications due to the pinning de-pinning process of the domain walls. Thus, the development of pseudo free energy that considers the metallography structure is necessary to describe the physics in inhomogeneous polycrystalline systems.