Search in sources :

Example 1 with LeafOutputCalculator

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;
}
Also used : RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegressionTree(edu.neu.ccs.pyramid.regression.regression_tree.RegressionTree) LeafOutputCalculator(edu.neu.ccs.pyramid.regression.regression_tree.LeafOutputCalculator)

Aggregations

LeafOutputCalculator (edu.neu.ccs.pyramid.regression.regression_tree.LeafOutputCalculator)1 RegTreeConfig (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig)1 RegressionTree (edu.neu.ccs.pyramid.regression.regression_tree.RegressionTree)1