Building the train and test dataset