Sample subLearnerOutOfTrainSet = trainSet.getOutOfSample(subLearnerTrainSet);
Sample subLearnerValidSet = (validSet == null || validSet.isEmpty() ? subLearnerOutOfTrainSet : validSet);
Ensemble subEnsemble = subLearner.learn(subLearnerTrainSet, subLearnerValidSet);
for (int t = 0; t < subEnsemble.getNumTrees(); t++) {
Tree tree = subEnsemble.getTreeAt(t);
double curTreeWeight = subEnsemble.getWeightAt(t);
if (backfit) {
tree.backfit(subLearnerOutOfTrainSet);
}
ensemble.addTree(tree, curTreeWeight);
System.out.println(tree.numLeaves);
}