Quantum metrology is one of the most relevant applications of quantum information theory to quantum technologies. Here, quantum probes are exploited to overcome classical bounds in the estimation of unknown parameters. In this context, phase estimation, where the unknown parameter is a phase shift between two modes of a quantum system, is a fundamental problem. In practical and realistic applications, it is necessary to devise methods to optimally estimate an unknown phase shift by using a limited number of probes. Here we introduce and experimentally demonstrate a machine learning-based approach for the adaptive estimation of a phase shift in a Mach-Zehnder interferometer, tailored for optimal performances with limited resources. The employed technique is a genetic algorithm used to devise the optimal feedback phases employed during the estimation in an offline fashion. The results show the capability to retrieve the true value of the phase by using few photons, and to reach the sensitivity bounds in such small probe regime. We finally investigate the robustness of the protocol with respect to common experimental errors, showing that the protocol can be adapted to a noisy scenario. Such approach promises to be a useful tool for more complex and general tasks where optimization of feedback parameters is required.