A prediction rigidity formalism for low-cost uncertainties in trained neural networks