finish implementing sub-sampling