add function to generate training and test data