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();
}
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);
}
}
Aggregations