use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.
the class LKBoostOptimizer method addPriors.
@Override
protected void addPriors() {
PriorProbClassifier priorProbClassifier = new PriorProbClassifier(numClasses);
priorProbClassifier.fit(dataSet, targetDistribution, weights);
double[] probs = priorProbClassifier.getClassProbs();
double[] scores = MathUtil.inverseSoftMax(probs);
// weaken the priors
for (int i = 0; i < scores.length; i++) {
if (scores[i] > 5) {
scores[i] = 5;
}
if (scores[i] < -5) {
scores[i] = -5;
}
}
for (int k = 0; k < numClasses; k++) {
Regressor constant = new ConstantRegressor(scores[k]);
boosting.getEnsemble(k).add(constant);
}
}
use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.
the class AdaBoostMH method predictClassScore.
public double predictClassScore(Vector vector, int k) {
List<Regressor> regressorsClassK = this.regressors.get(k);
double score = 0;
for (Regressor regressor : regressorsClassK) {
score += regressor.predict(vector);
}
return score;
}
use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.
the class HMLGBTrainer 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.updateClassScores(regressor, k);
}
/**
* parallel by data
*/
this.updateAssignmentProbMatrix();
this.updateProbabilityMatrix();
this.updateClassGradientMatrix();
}
use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.
the class HMLGradientBoosting method predictClassScore.
/**
*
* @param vector
* @param k class index
* @return
*/
public double predictClassScore(Vector vector, int k) {
List<Regressor> regressorsClassK = this.regressors.get(k);
double score = 0;
for (Regressor regressor : regressorsClassK) {
score += regressor.predict(vector);
}
return score;
}
use of edu.neu.ccs.pyramid.regression.Regressor in project pyramid by cheng-li.
the class MBoostOptimizer method addPriors.
@Override
protected void addPriors() {
double median = MathUtil.weightedMedian(labels, weights);
Regressor constant = new ConstantRegressor(median);
boosting.getEnsemble(0).add(constant);
}
Aggregations