Mechanical metamaterial actuators achieve pre-determined input–outputoperations exploiting architectural features encoded within a single 3D printed element, thus removing the need for assembling different structuralcomponents. Despite the rapid progress in the field, there is still a need forefficient strategies to optimize metamaterial design for a variety of functions.We present a computational method for the automatic design of mechanicalmetamaterial actuators that combines a reinforced Monte Carlo method with discrete element simulations. 3D printing of selected mechanical metamaterial actuators shows that the machine-generated structures canreach high efficiency, exceeding human-designed structures. We also show that it is possible to design efficient actuators by training a deep neural network which is then able to predict the efficiency from the image of a structure and to identify its functional regions. The elementary actuators devised here can be combined to produce metamaterial machines of arbitrary complexity for countless engineering applications.