splitDataset function

Split dataset according to config.