Metasurface-based optical elements enable abrupt wavefront engineering by locally controlling the properties (amplitude, phase, etc.) of the incident illumination. They hold great potential to promote a new generation of wearable devices and thin optical systems for imaging and sensing. To date, most of the existing metasurface designs rely on highaspect-ratio nanostructures, with a thickness close to or even higher than the wavelength. There has been an increasing demand to reduce the metasurface thickness and nanostructure aspect-ratio, in order to facilitate the fabrication compatibility and integration with electronics and dynamic tunable platforms. Here we demonstrate ultrathin (∼ 1/5 of the wavelength) transmissive metalenses for the visible light, using two different approaches of either amplitude or phase modulation. For amplitude modulation, we developed a digital transmission coding scheme that allows manipulation of multiple wavelengths without increasing the thickness or complexity of the structural elements. In order to improve the optical efficiency, phase modulation is necessary, but the design is more challenging. Because the nanoresonators are electromagnetically coupled with each other, compared with high-aspect-ratio nanostructures with wave-guiding confinement. To solve this problem, we developed an inverse design strategy using machine learning. We employ evolutionary algorithms interfaced with Finite-Difference Time-Domain solvers, which not only mimic natural selection in order to determine the optimal arrangement of nanoresonators to achieve the desired target optical functions, but also consider and benefit from the strong interactions between nanoresonators to improve the performance. The machine learning designs significantly improve the focusing efficiency, approximately double of the conventional human designs.