Hamilton-Jacobi Equations for Statistical Inference Problems