Search in sources :

Example 1 with GradientDescent

use of edu.neu.ccs.pyramid.optimization.GradientDescent in project pyramid by cheng-li.

the class LogRiskOptimizer method updateModelPartial.

private void updateModelPartial() {
    if (logger.isDebugEnabled()) {
        logger.debug("start updateModelPartial()");
    }
    KLLoss klLoss = new KLLoss(crf, dataSet, targets, variance);
    // todo
    Optimizer opt = null;
    switch(optimizer) {
        case "LBFGS":
            opt = new LBFGS(klLoss);
            break;
        case "GD":
            opt = new GradientDescent(klLoss);
            break;
        default:
            throw new IllegalArgumentException("unknown");
    }
    opt.getTerminator().setMaxIteration(10);
    opt.optimize();
    if (logger.isDebugEnabled()) {
        logger.debug("finish updateModelPartial()");
    }
}
Also used : LBFGS(edu.neu.ccs.pyramid.optimization.LBFGS) Optimizer(edu.neu.ccs.pyramid.optimization.Optimizer) GradientDescent(edu.neu.ccs.pyramid.optimization.GradientDescent)

Example 2 with GradientDescent

use of edu.neu.ccs.pyramid.optimization.GradientDescent in project pyramid by cheng-li.

the class NoiseOptimizerLR method updateModel.

private void updateModel() {
    if (logger.isDebugEnabled()) {
        logger.debug("start updateModel()");
    }
    KLLoss klLoss = new KLLoss(crf, dataSet, targets, variance);
    // todo
    Optimizer opt = null;
    switch(optimizer) {
        case "LBFGS":
            opt = new LBFGS(klLoss);
            break;
        case "GD":
            opt = new GradientDescent(klLoss);
            break;
        default:
            throw new IllegalArgumentException("unknown");
    }
    opt.optimize();
    if (logger.isDebugEnabled()) {
        logger.debug("finish updateModel()");
    }
}
Also used : LBFGS(edu.neu.ccs.pyramid.optimization.LBFGS) Optimizer(edu.neu.ccs.pyramid.optimization.Optimizer) RidgeLogisticOptimizer(edu.neu.ccs.pyramid.classification.logistic_regression.RidgeLogisticOptimizer) GradientDescent(edu.neu.ccs.pyramid.optimization.GradientDescent)

Example 3 with GradientDescent

use of edu.neu.ccs.pyramid.optimization.GradientDescent in project pyramid by cheng-li.

the class NoiseOptimizerLR method updateModelPartial.

private void updateModelPartial(int modelIterations) {
    if (logger.isDebugEnabled()) {
        logger.debug("start updateModelPartial()");
    }
    KLLoss klLoss = new KLLoss(crf, dataSet, targets, variance);
    // todo
    Optimizer opt = null;
    switch(optimizer) {
        case "LBFGS":
            opt = new LBFGS(klLoss);
            break;
        case "GD":
            opt = new GradientDescent(klLoss);
            break;
        default:
            throw new IllegalArgumentException("unknown");
    }
    opt.getTerminator().setMaxIteration(modelIterations);
    opt.optimize();
    if (logger.isDebugEnabled()) {
        logger.debug("finish updateModelPartial()");
    }
}
Also used : LBFGS(edu.neu.ccs.pyramid.optimization.LBFGS) Optimizer(edu.neu.ccs.pyramid.optimization.Optimizer) RidgeLogisticOptimizer(edu.neu.ccs.pyramid.classification.logistic_regression.RidgeLogisticOptimizer) GradientDescent(edu.neu.ccs.pyramid.optimization.GradientDescent)

Example 4 with GradientDescent

use of edu.neu.ccs.pyramid.optimization.GradientDescent in project pyramid by cheng-li.

the class NoiseOptimizer method updateModel.

private void updateModel() {
    if (logger.isDebugEnabled()) {
        logger.debug("start updateModel()");
    }
    KLLoss klLoss = new KLLoss(crf, dataSet, targets, variance);
    // todo
    Optimizer opt = null;
    switch(optimizer) {
        case "LBFGS":
            opt = new LBFGS(klLoss);
            break;
        case "GD":
            opt = new GradientDescent(klLoss);
            break;
        default:
            throw new IllegalArgumentException("unknown");
    }
    opt.optimize();
    if (logger.isDebugEnabled()) {
        logger.debug("finish updateModel()");
    }
}
Also used : LBFGS(edu.neu.ccs.pyramid.optimization.LBFGS) Optimizer(edu.neu.ccs.pyramid.optimization.Optimizer) GradientDescent(edu.neu.ccs.pyramid.optimization.GradientDescent)

Example 5 with GradientDescent

use of edu.neu.ccs.pyramid.optimization.GradientDescent in project pyramid by cheng-li.

the class NoiseOptimizer method updateModelPartial.

private void updateModelPartial(int modelIterations) {
    if (logger.isDebugEnabled()) {
        logger.debug("start updateModelPartial()");
    }
    KLLoss klLoss = new KLLoss(crf, dataSet, targets, variance);
    // todo
    Optimizer opt = null;
    switch(optimizer) {
        case "LBFGS":
            opt = new LBFGS(klLoss);
            break;
        case "GD":
            opt = new GradientDescent(klLoss);
            break;
        default:
            throw new IllegalArgumentException("unknown");
    }
    opt.getTerminator().setMaxIteration(modelIterations);
    opt.optimize();
    if (logger.isDebugEnabled()) {
        logger.debug("finish updateModelPartial()");
    }
}
Also used : LBFGS(edu.neu.ccs.pyramid.optimization.LBFGS) Optimizer(edu.neu.ccs.pyramid.optimization.Optimizer) GradientDescent(edu.neu.ccs.pyramid.optimization.GradientDescent)

Aggregations

GradientDescent (edu.neu.ccs.pyramid.optimization.GradientDescent)8 LBFGS (edu.neu.ccs.pyramid.optimization.LBFGS)7 Optimizer (edu.neu.ccs.pyramid.optimization.Optimizer)6 RidgeLogisticOptimizer (edu.neu.ccs.pyramid.classification.logistic_regression.RidgeLogisticOptimizer)2 File (java.io.File)2 ClfDataSet (edu.neu.ccs.pyramid.dataset.ClfDataSet)1 MultiLabel (edu.neu.ccs.pyramid.dataset.MultiLabel)1 MultiLabelClfDataSet (edu.neu.ccs.pyramid.dataset.MultiLabelClfDataSet)1 CMLCRF (edu.neu.ccs.pyramid.multilabel_classification.crf.CMLCRF)1 CRFLoss (edu.neu.ccs.pyramid.multilabel_classification.crf.CRFLoss)1 ConjugateGradientDescent (edu.neu.ccs.pyramid.optimization.ConjugateGradientDescent)1