Helper function to combine ensembles of trees