Machine Learning for Model Error Inference and Correction