use of edu.neu.ccs.pyramid.optimization.LBFGS 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()");
}
}
use of edu.neu.ccs.pyramid.optimization.LBFGS 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()");
}
}
use of edu.neu.ccs.pyramid.optimization.LBFGS 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()");
}
}
use of edu.neu.ccs.pyramid.optimization.LBFGS in project pyramid by cheng-li.
the class IMLLogisticTrainer method train.
public IMLLogisticRegression train(MultiLabelClfDataSet dataset, List<MultiLabel> assignments) {
IMLLogisticRegression IMLLogisticRegression = new IMLLogisticRegression(dataset.getNumClasses(), dataset.getNumFeatures(), assignments);
IMLLogisticRegression.setFeatureList(dataset.getFeatureList());
IMLLogisticRegression.setLabelTranslator(dataset.getLabelTranslator());
IMLLogisticLoss function = new IMLLogisticLoss(IMLLogisticRegression, dataset, gaussianPriorVariance);
LBFGS lbfgs = new LBFGS(function);
lbfgs.getTerminator().setRelativeEpsilon(epsilon);
lbfgs.setHistory(history);
lbfgs.optimize();
return IMLLogisticRegression;
}
use of edu.neu.ccs.pyramid.optimization.LBFGS in project pyramid by cheng-li.
the class MLLogisticTrainer method train.
public MLLogisticRegression train(MultiLabelClfDataSet dataset, List<MultiLabel> assignments) {
MLLogisticRegression mlLogisticRegression = new MLLogisticRegression(dataset.getNumClasses(), dataset.getNumFeatures(), assignments);
mlLogisticRegression.setFeatureList(dataset.getFeatureList());
mlLogisticRegression.setLabelTranslator(dataset.getLabelTranslator());
mlLogisticRegression.setFeatureExtraction(false);
MLLogisticLoss function = new MLLogisticLoss(mlLogisticRegression, dataset, gaussianPriorVariance);
LBFGS lbfgs = new LBFGS(function);
lbfgs.optimize();
return mlLogisticRegression;
}
Aggregations