Cloud Computing is a paradigm allowing access to physical and application resources online via the Internet. These resources are virtualized using virtualization software to make them available to users as a service. In this environment, the migration of virtual machines (VMs) is a significant concern these days. This technique provided by virtualization technology impacts the performance of the cloud. When allocating resources, the distribution of VMs is unbalanced, and their migration from one server to another can increase energy consumption and network overhead, necessitating an improvement in VM migrations. This paper presents a machine learning model for migrating virtual machines. The goal is to improve the selection of virtual machines and migration processes by reducing energy consumption and the number of VMs migrations. Numerical results demonstrate that the proposed solution can significantly enhance the goals addressed.