use of edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator in project pyramid by cheng-li.
the class CBMNoiseOptimizerFixed method updateBinaryBoosting.
private void updateBinaryBoosting(int componentIndex, int labelIndex) {
int numIterations = numIterationsBinary;
double shrinkage = shrinkageBinary;
LKBoost boost = (LKBoost) this.cbm.binaryClassifiers[componentIndex][labelIndex];
RegTreeConfig regTreeConfig = new RegTreeConfig().setMaxNumLeaves(numLeavesBinary);
RegTreeFactory regTreeFactory = new RegTreeFactory(regTreeConfig);
regTreeFactory.setLeafOutputCalculator(new LKBOutputCalculator(2));
LKBoostOptimizer optimizer = new LKBoostOptimizer(boost, dataSet, regTreeFactory, gammasT[componentIndex], binaryTargetsDistributions[labelIndex]);
optimizer.setShrinkage(shrinkage);
optimizer.initialize();
optimizer.iterate(numIterations);
}
use of edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator in project pyramid by cheng-li.
the class CBMNoiseOptimizerFixed method updateMultiClassBoost.
private void updateMultiClassBoost() {
int numComponents = cbm.numComponents;
int numIterations = numIterationsMultiClass;
double shrinkage = shrinkageMultiClass;
LKBoost boost = (LKBoost) this.cbm.multiClassClassifier;
RegTreeConfig regTreeConfig = new RegTreeConfig().setMaxNumLeaves(numLeavesMultiClass);
RegTreeFactory regTreeFactory = new RegTreeFactory(regTreeConfig);
regTreeFactory.setLeafOutputCalculator(new LKBOutputCalculator(numComponents));
LKBoostOptimizer optimizer = new LKBoostOptimizer(boost, dataSet, regTreeFactory, gammas);
optimizer.setShrinkage(shrinkage);
optimizer.initialize();
optimizer.iterate(numIterations);
}
use of edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator in project pyramid by cheng-li.
the class CBMOptimizer method updateMultiClassBoost.
private void updateMultiClassBoost() {
int numComponents = cbm.numComponents;
int numIterations = numIterationsMultiClass;
double shrinkage = shrinkageMultiClass;
LKBoost boost = (LKBoost) this.cbm.multiClassClassifier;
RegTreeConfig regTreeConfig = new RegTreeConfig().setMaxNumLeaves(numLeavesMultiClass);
RegTreeFactory regTreeFactory = new RegTreeFactory(regTreeConfig);
regTreeFactory.setLeafOutputCalculator(new LKBOutputCalculator(numComponents));
LKBoostOptimizer optimizer = new LKBoostOptimizer(boost, dataSet, regTreeFactory, gammas);
optimizer.setShrinkage(shrinkage);
optimizer.initialize();
optimizer.iterate(numIterations);
}
use of edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator in project pyramid by cheng-li.
the class CBMOptimizer method updateBinaryBoosting.
private void updateBinaryBoosting(int componentIndex, int labelIndex) {
int numIterations = numIterationsBinary;
double shrinkage = shrinkageBinary;
LKBoost boost = (LKBoost) this.cbm.binaryClassifiers[componentIndex][labelIndex];
RegTreeConfig regTreeConfig = new RegTreeConfig().setMaxNumLeaves(numLeavesBinary);
RegTreeFactory regTreeFactory = new RegTreeFactory(regTreeConfig);
regTreeFactory.setLeafOutputCalculator(new LKBOutputCalculator(2));
LKBoostOptimizer optimizer = new LKBoostOptimizer(boost, dataSet, regTreeFactory, gammasT[componentIndex], targetsDistributions[labelIndex]);
optimizer.setShrinkage(shrinkage);
optimizer.initialize();
optimizer.iterate(numIterations);
}
use of edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator in project pyramid by cheng-li.
the class GBCBMOptimizer method updateBinaryClassifier.
@Override
protected void updateBinaryClassifier(int component, int label, MultiLabelClfDataSet activeDataset, double[] activeGammas) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
if (cbm.binaryClassifiers[component][label] == null || cbm.binaryClassifiers[component][label] instanceof PriorProbClassifier) {
cbm.binaryClassifiers[component][label] = new LKBoost(2);
}
int[] binaryLabels = DataSetUtil.toBinaryLabels(activeDataset.getMultiLabels(), label);
double[][] targetsDistributions = DataSetUtil.labelsToDistributions(binaryLabels, 2);
LKBoost boost = (LKBoost) this.cbm.binaryClassifiers[component][label];
RegTreeConfig regTreeConfig = new RegTreeConfig().setMaxNumLeaves(numLeaves);
RegTreeFactory regTreeFactory = new RegTreeFactory(regTreeConfig);
regTreeFactory.setLeafOutputCalculator(new LKBOutputCalculator(2));
LKBoostOptimizer optimizer = new LKBoostOptimizer(boost, activeDataset, regTreeFactory, activeGammas, targetsDistributions);
optimizer.setShrinkage(shrinkage);
optimizer.initialize();
optimizer.iterate(binaryUpdatesPerIter);
if (logger.isDebugEnabled()) {
logger.debug("time spent on updating component " + component + " label " + label + " = " + stopWatch);
}
}
Aggregations