check_training_indices function

Check the validity of the training indices