added split function to split data in training and test set