Program: 131230
Project: 131230
Buggy source:
private static CrfTrainerPrm getCrfTrainerPrm() throws ParseException {
  FgInferencerFactory infPrm=getInfFactory();
  CrfTrainerPrm prm=new CrfTrainerPrm();
  prm.infFactory=infPrm;
  if (infPrm instanceof BeliefsModuleFactory) {
    prm.bFactory=(BeliefsModuleFactory)infPrm;
  }
  if (optimizer == Optimizer.LBFGS) {
    prm.optimizer=getMalletLbfgs();
    prm.batchOptimizer=null;
  }
 else   if (optimizer == Optimizer.QN) {
    prm.optimizer=getStanfordLbfgs();
    prm.batchOptimizer=null;
  }
 else   if (optimizer == Optimizer.SGD || optimizer == Optimizer.ASGD || optimizer == Optimizer.ADAGRAD || optimizer == Optimizer.ADADELTA) {
    prm.optimizer=null;
    SGDPrm sgdPrm=getSgdPrm();
    if (optimizer == Optimizer.SGD) {
      BottouSchedulePrm boPrm=new BottouSchedulePrm();
      boPrm.initialLr=sgdInitialLr;
      boPrm.lambda=1.0 / l2variance;
      sgdPrm.sched=new BottouSchedule(boPrm);
    }
 else     if (optimizer == Optimizer.ASGD) {
      BottouSchedulePrm boPrm=new BottouSchedulePrm();
      boPrm.initialLr=sgdInitialLr;
      boPrm.lambda=1.0 / l2variance;
      boPrm.power=0.75;
      sgdPrm.sched=new BottouSchedule(boPrm);
      sgdPrm.averaging=true;
    }
 else     if (optimizer == Optimizer.ADAGRAD) {
      AdaGradSchedulePrm adaGradPrm=new AdaGradSchedulePrm();
      adaGradPrm.eta=adaGradEta;
      adaGradPrm.constantAddend=adaDeltaConstantAddend;
      sgdPrm.sched=new AdaGradSchedule(adaGradPrm);
    }
 else     if (optimizer == Optimizer.ADADELTA) {
      AdaDeltaPrm adaDeltaPrm=new AdaDeltaPrm();
      adaDeltaPrm.decayRate=adaDeltaDecayRate;
      adaDeltaPrm.constantAddend=adaDeltaConstantAddend;
      sgdPrm.sched=new AdaDelta(adaDeltaPrm);
      sgdPrm.autoSelectLr=false;
    }
    prm.batchOptimizer=new SGD(sgdPrm);
  }
 else   if (optimizer == Optimizer.ADAGRAD_COMID) {
    AdaGradComidL2Prm sgdPrm=new AdaGradComidL2Prm();
    setSgdPrm(sgdPrm);
    sgdPrm.l2Lambda=1.0 / l2variance;
    sgdPrm.eta=adaGradEta;
    sgdPrm.constantAddend=adaDeltaConstantAddend;
    sgdPrm.sched=null;
    prm.optimizer=null;
    prm.batchOptimizer=new AdaGradComidL2(sgdPrm);
  }
 else   if (optimizer == Optimizer.FOBOS) {
    SGDFobosPrm sgdPrm=new SGDFobosPrm();
    setSgdPrm(sgdPrm);
    sgdPrm.l2Lambda=1.0 / l2variance;
    BottouSchedulePrm boPrm=new BottouSchedulePrm();
    boPrm.initialLr=sgdInitialLr;
    boPrm.lambda=1.0 / l2variance;
    sgdPrm.sched=new BottouSchedule(boPrm);
    prm.optimizer=null;
    prm.batchOptimizer=new SGDFobos(sgdPrm);
  }
 else {
    throw new RuntimeException("String_Node_Str" + optimizer);
  }
  if (regularizer == RegularizerType.L2) {
    prm.regularizer=new L2(l2variance);
  }
 else   if (regularizer == RegularizerType.NONE) {
    prm.regularizer=null;
  }
 else {
    throw new ParseException("String_Node_Str" + regularizer);
  }
  prm.numThreads=threads;
  prm.useMseForValue=useMseForValue;
  prm.trainer=trainer;
  if (prm.trainer == Trainer.ERMA && CorpusHandler.getPredAts().equals(Lists.getList(AT.DEP_TREE))) {
    if (dpLoss == ErmaLoss.DP_DECODE_LOSS) {
      DepParseDecodeLossFactory lossPrm=new DepParseDecodeLossFactory();
      lossPrm.annealMse=dpAnnealMse;
      lossPrm.startTemp=dpStartTemp;
      lossPrm.endTemp=dpEndTemp;
      prm.dlFactory=lossPrm;
    }
 else     if (dpLoss == ErmaLoss.MSE) {
      prm.dlFactory=new MeanSquaredErrorFactory();
    }
 else     if (dpLoss == ErmaLoss.EXPECTED_RECALL) {
      prm.dlFactory=new ExpectedRecallFactory();
    }
  }
  return prm;
}

Fixed version (ground truth):
private static CrfTrainerPrm getCrfTrainerPrm() throws ParseException {
  FgInferencerFactory infPrm=getInfFactory();
  CrfTrainerPrm prm=new CrfTrainerPrm();
  prm.infFactory=infPrm;
  if (infPrm instanceof BeliefsModuleFactory) {
    prm.bFactory=(BeliefsModuleFactory)infPrm;
  }
  if (optimizer == Optimizer.LBFGS) {
    prm.optimizer=getMalletLbfgs();
    prm.batchOptimizer=null;
  }
 else   if (optimizer == Optimizer.QN) {
    prm.optimizer=getStanfordLbfgs();
    prm.batchOptimizer=null;
  }
 else   if (optimizer == Optimizer.SGD || optimizer == Optimizer.ASGD || optimizer == Optimizer.ADAGRAD || optimizer == Optimizer.ADADELTA) {
    prm.optimizer=null;
    SGDPrm sgdPrm=getSgdPrm();
    if (optimizer == Optimizer.SGD) {
      BottouSchedulePrm boPrm=new BottouSchedulePrm();
      boPrm.initialLr=sgdInitialLr;
      boPrm.lambda=1.0 / l2variance;
      sgdPrm.sched=new BottouSchedule(boPrm);
    }
 else     if (optimizer == Optimizer.ASGD) {
      BottouSchedulePrm boPrm=new BottouSchedulePrm();
      boPrm.initialLr=sgdInitialLr;
      boPrm.lambda=1.0 / l2variance;
      boPrm.power=0.75;
      sgdPrm.sched=new BottouSchedule(boPrm);
      sgdPrm.averaging=true;
    }
 else     if (optimizer == Optimizer.ADAGRAD) {
      AdaGradSchedulePrm adaGradPrm=new AdaGradSchedulePrm();
      adaGradPrm.eta=adaGradEta;
      adaGradPrm.constantAddend=adaGradConstantAddend;
      sgdPrm.sched=new AdaGradSchedule(adaGradPrm);
    }
 else     if (optimizer == Optimizer.ADADELTA) {
      AdaDeltaPrm adaDeltaPrm=new AdaDeltaPrm();
      adaDeltaPrm.decayRate=adaDeltaDecayRate;
      adaDeltaPrm.constantAddend=adaDeltaConstantAddend;
      sgdPrm.sched=new AdaDelta(adaDeltaPrm);
      sgdPrm.autoSelectLr=false;
    }
    prm.batchOptimizer=new SGD(sgdPrm);
  }
 else   if (optimizer == Optimizer.ADAGRAD_COMID) {
    AdaGradComidL2Prm sgdPrm=new AdaGradComidL2Prm();
    setSgdPrm(sgdPrm);
    sgdPrm.l2Lambda=1.0 / l2variance;
    sgdPrm.eta=adaGradEta;
    sgdPrm.constantAddend=adaGradConstantAddend;
    sgdPrm.sched=null;
    prm.optimizer=null;
    prm.batchOptimizer=new AdaGradComidL2(sgdPrm);
  }
 else   if (optimizer == Optimizer.FOBOS) {
    SGDFobosPrm sgdPrm=new SGDFobosPrm();
    setSgdPrm(sgdPrm);
    sgdPrm.l2Lambda=1.0 / l2variance;
    BottouSchedulePrm boPrm=new BottouSchedulePrm();
    boPrm.initialLr=sgdInitialLr;
    boPrm.lambda=1.0 / l2variance;
    sgdPrm.sched=new BottouSchedule(boPrm);
    prm.optimizer=null;
    prm.batchOptimizer=new SGDFobos(sgdPrm);
  }
 else {
    throw new RuntimeException("String_Node_Str" + optimizer);
  }
  if (regularizer == RegularizerType.L2) {
    prm.regularizer=new L2(l2variance);
  }
 else   if (regularizer == RegularizerType.NONE) {
    prm.regularizer=null;
  }
 else {
    throw new ParseException("String_Node_Str" + regularizer);
  }
  prm.numThreads=threads;
  prm.useMseForValue=useMseForValue;
  prm.trainer=trainer;
  if (prm.trainer == Trainer.ERMA && CorpusHandler.getPredAts().equals(Lists.getList(AT.DEP_TREE))) {
    if (dpLoss == ErmaLoss.DP_DECODE_LOSS) {
      DepParseDecodeLossFactory lossPrm=new DepParseDecodeLossFactory();
      lossPrm.annealMse=dpAnnealMse;
      lossPrm.startTemp=dpStartTemp;
      lossPrm.endTemp=dpEndTemp;
      prm.dlFactory=lossPrm;
    }
 else     if (dpLoss == ErmaLoss.MSE) {
      prm.dlFactory=new MeanSquaredErrorFactory();
    }
 else     if (dpLoss == ErmaLoss.EXPECTED_RECALL) {
      prm.dlFactory=new ExpectedRecallFactory();
    }
  }
  return prm;
}