Search in sources :

Example 6 with LKBoostOptimizer

use of edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer 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);
}
Also used : LKBoostOptimizer(edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer) RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegTreeFactory(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory) LKBOutputCalculator(edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator) LKBoost(edu.neu.ccs.pyramid.classification.lkboost.LKBoost)

Example 7 with LKBoostOptimizer

use of edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer 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);
}
Also used : LKBoostOptimizer(edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer) RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegTreeFactory(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory) LKBOutputCalculator(edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator) LKBoost(edu.neu.ccs.pyramid.classification.lkboost.LKBoost)

Example 8 with LKBoostOptimizer

use of edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer 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);
}
Also used : LKBoostOptimizer(edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer) RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegTreeFactory(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory) LKBOutputCalculator(edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator) LKBoost(edu.neu.ccs.pyramid.classification.lkboost.LKBoost)

Example 9 with LKBoostOptimizer

use of edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer 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);
}
Also used : LKBoostOptimizer(edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer) RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegTreeFactory(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory) LKBOutputCalculator(edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator) LKBoost(edu.neu.ccs.pyramid.classification.lkboost.LKBoost)

Example 10 with LKBoostOptimizer

use of edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer 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);
    }
}
Also used : LKBoostOptimizer(edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer) RegTreeConfig(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig) RegTreeFactory(edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory) LKBOutputCalculator(edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator) PriorProbClassifier(edu.neu.ccs.pyramid.classification.PriorProbClassifier) StopWatch(org.apache.commons.lang3.time.StopWatch) LKBoost(edu.neu.ccs.pyramid.classification.lkboost.LKBoost)

Aggregations

LKBOutputCalculator (edu.neu.ccs.pyramid.classification.lkboost.LKBOutputCalculator)10 LKBoost (edu.neu.ccs.pyramid.classification.lkboost.LKBoost)10 LKBoostOptimizer (edu.neu.ccs.pyramid.classification.lkboost.LKBoostOptimizer)10 RegTreeConfig (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig)10 RegTreeFactory (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory)10 PriorProbClassifier (edu.neu.ccs.pyramid.classification.PriorProbClassifier)1 ClfDataSet (edu.neu.ccs.pyramid.dataset.ClfDataSet)1 DataSetType (edu.neu.ccs.pyramid.dataset.DataSetType)1 File (java.io.File)1 StopWatch (org.apache.commons.lang3.time.StopWatch)1