made the trainer function take into account train/total fraction and ignore empty trees