A method for approximating optimal statistical significances with machine-learned likelihoods