added a training break condition for NaN avg costs