An Uncertainty-aware Loss Function for Training Neural Networks with Calibrated Predictions