Wavefront sensorless adaptive optics methodologies are considered in many applications where the deployment of a dedicated wavefront sensor is inconvenient, such as in fluorescence microscopy. In these methodologies, aberration correction is achieved by sequentially changing the settings of the adaptive optical element until a predetermined imaging quality metric is optimised. Reducing the time required for this optimisation is a challenge. In this paper, a two stage data driven optimisation procedure is presented and validated in a laboratory environment. In the first stage, known aberrations are introduced by a deformable mirror and the corresponding intensities are measured by a photodiode masked by a pinhole. A generic quadratic metric is fitted to this collection of aberrations and intensity measurements. In the second stage, this quadratic metric is used in order to estimate and correct for optical aberrations. A closed form expression for the optimisation of the quadratic metric is derived by solving a linear system of equations. This requires a minimum of N +1 pairs of deformable mirror settings and intensity measurements, where N is the number of modes of the aberrations.