Stops training when validation loss stops improving.
@spec wait(pos_integer(), float()) :: (map() -> map())