The Best Time to Specialize or to Generalize