Search in sources :

Example 1 with Optimizer

use of edu.neu.ccs.pyramid.optimization.Optimizer 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 Optimizer

use of edu.neu.ccs.pyramid.optimization.Optimizer 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 Optimizer

use of edu.neu.ccs.pyramid.optimization.Optimizer 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 Optimizer

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

the class LogRiskOptimizer 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 Optimizer

use of edu.neu.ccs.pyramid.optimization.Optimizer 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)6 LBFGS (edu.neu.ccs.pyramid.optimization.LBFGS)6 Optimizer (edu.neu.ccs.pyramid.optimization.Optimizer)6 RidgeLogisticOptimizer (edu.neu.ccs.pyramid.classification.logistic_regression.RidgeLogisticOptimizer)2