Precompute and store features for train/valid sets