code to make a proper training set