Optimized train and test set selections