The training objective function