The optimization of laser pulse shapes is of great importance and a major challenge for laser direct-drive implosions. In this paper, we propose an efficient intelligent method to perform laser pulse optimization via hydrodynamic simulations guided by the genetic algorithm and random forest algorithm. Compared to manual optimizations, the machine-learning guided method is able to efficiently improve the areal density by a factor of 63% and reduce the in-flight-aspect ratio by a factor of 30% at the same time. A relationship between the maximum areal density and ion temperature is also achieved by the analysis of the big simulation dataset. This design method has been successfully demonstrated by the 2021 summer double-cone ignition experiments conducted at the SG-II upgrade laser facility and has great prospects for the design of other inertial fusion experiments.