Search in sources :

Example 16 with Regressor

use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.

the class AdaBoostMHTrainer method iterate.

public void iterate() {
    for (int k = 0; k < this.boosting.getNumClasses(); k++) {
        /**
             * parallel by feature
             */
        Regressor regressor = this.fitClassK(k);
        this.boosting.addRegressor(regressor, k);
        /**
             * parallel by data
             */
        this.updateStagedClassScores(regressor, k);
    }
    this.updateDistribution();
}
Also used : Regressor(edu.neu.ccs.pyramid.regression.Regressor) ConstantRegressor(edu.neu.ccs.pyramid.regression.ConstantRegressor)

Example 17 with Regressor

use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.

the class AdaBoostMHTrainer method setPriorProbs.

private void setPriorProbs(double[] probs) {
    if (probs.length != this.boosting.getNumClasses()) {
        throw new IllegalArgumentException("probs.length!=this.numClasses");
    }
    double average = Arrays.stream(probs).map(Math::log).average().getAsDouble();
    for (int k = 0; k < this.boosting.getNumClasses(); k++) {
        double score = Math.log(probs[k] - average);
        Regressor constant = new ConstantRegressor(score);
        this.boosting.addRegressor(constant, k);
    }
}
Also used : Regressor(edu.neu.ccs.pyramid.regression.Regressor) ConstantRegressor(edu.neu.ccs.pyramid.regression.ConstantRegressor) ConstantRegressor(edu.neu.ccs.pyramid.regression.ConstantRegressor)

Aggregations

Regressor (edu.neu.ccs.pyramid.regression.Regressor)17 ConstantRegressor (edu.neu.ccs.pyramid.regression.ConstantRegressor)11 PriorProbClassifier (edu.neu.ccs.pyramid.classification.PriorProbClassifier)1 LKBoost (edu.neu.ccs.pyramid.classification.lkboost.LKBoost)1 LabelTranslator (edu.neu.ccs.pyramid.dataset.LabelTranslator)1 Feature (edu.neu.ccs.pyramid.feature.Feature)1 TopFeatures (edu.neu.ccs.pyramid.feature.TopFeatures)1 RegTreeInspector (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeInspector)1 RegressionTree (edu.neu.ccs.pyramid.regression.regression_tree.RegressionTree)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1