In digital holography, it is crucial to extract the object distance from a hologram in order to reconstruct its amplitude and phase. This is known as autofocusing, which is conventionally solved by first reconstructing a stack of images, and then the sharpness of each reconstructed image is computed using a focus metric such as entropy or variance. The distance corresponding to the sharpest image is considered the focal position. This approach, while effective, is computationally demanding and time-consuming. To cope with this problem, we turn to machine learning, where we cast the autofocusing as a regression problem, with the focal distance being a continuous response corresponding to each hologram. Therefore, distance estimation is converted to hologram prediction, which we solve by designing a powerful convolutional neural network trained by a set of holograms acquired a priori. Experimental results show that this allows fast autofocusing without reconstructing an image stack, even when the physical parameters of the optical setup are unknown. (C) 2018 Optical Society of America under the terms of the OSA Open Access Publishing Agreement