use of edu.neu.ccs.pyramid.regression.regression_tree.LeafOutputCalculator in project pyramid by cheng-li.
the class HMLGBTrainer method fitClassK.
/**
* parallel
* find the best regression tree for class k
* apply newton step and learning rate
* @param k class index
* @return regressionTreeLk, shrunk
* @throws Exception
*/
private RegressionTree fitClassK(int k) {
double[] gradients = gradientMatrix.getGradientsForClass(k);
int numClasses = this.config.getDataSet().getNumClasses();
double learningRate = this.config.getLearningRate();
LeafOutputCalculator leafOutputCalculator = new HMLGBLeafOutputCalculator(numClasses);
RegTreeConfig regTreeConfig = new RegTreeConfig();
regTreeConfig.setMaxNumLeaves(this.config.getNumLeaves());
regTreeConfig.setMinDataPerLeaf(this.config.getMinDataPerLeaf());
regTreeConfig.setNumSplitIntervals(this.config.getNumSplitIntervals());
RegressionTree regressionTree = RegTreeTrainer.fit(regTreeConfig, this.config.getDataSet(), gradients, leafOutputCalculator);
regressionTree.shrink(learningRate);
return regressionTree;
}
Aggregations