Training neural network ensembles via trajectory sampling