Added a function to create a training set with a fixed number of events