Add optional validation during training