Program: 32917
Project: 32917
Buggy source:
static void train(Config config,Logger logger) throws Exception {
  String output=config.getString("String_Node_Str");
  int numIterations=config.getInt("String_Node_Str");
  int numLeaves=config.getInt("String_Node_Str");
  double learningRate=config.getDouble("String_Node_Str");
  int minDataPerLeaf=config.getInt("String_Node_Str");
  String modelName="String_Node_Str";
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  MultiLabelClfDataSet allTrainData=loadData(config,config.getString("String_Node_Str"));
  MultiLabelClfDataSet testSet=null;
  if (config.getBoolean("String_Node_Str")) {
    testSet=loadData(config,config.getString("String_Node_Str"));
  }
  int numClasses=allTrainData.getNumClasses();
  logger.info("String_Node_Str" + numClasses);
  IMLGradientBoosting boosting;
  if (config.getBoolean("String_Node_Str")) {
    boosting=IMLGradientBoosting.deserialize(new File(output,modelName));
  }
 else {
    boosting=new IMLGradientBoosting(numClasses);
  }
  logger.info("String_Node_Str");
  boolean earlyStop=config.getBoolean("String_Node_Str");
  List<EarlyStopper> earlyStoppers=new ArrayList<>();
  List<Terminator> terminators=new ArrayList<>();
  boolean[] shouldStop=new boolean[allTrainData.getNumClasses()];
  if (earlyStop) {
    for (int l=0; l < numClasses; l++) {
      EarlyStopper earlyStopper=new EarlyStopper(EarlyStopper.Goal.MINIMIZE,config.getInt("String_Node_Str"));
      earlyStopper.setMinimumIterations(config.getInt("String_Node_Str"));
      earlyStoppers.add(earlyStopper);
    }
    for (int l=0; l < numClasses; l++) {
      Terminator terminator=new Terminator();
      terminator.setMaxStableIterations(config.getInt("String_Node_Str")).setMinIterations(config.getInt("String_Node_Str") / config.getInt("String_Node_Str")).setAbsoluteEpsilon(config.getDouble("String_Node_Str")).setRelativeEpsilon(config.getDouble("String_Node_Str")).setOperation(Terminator.Operation.OR);
      terminators.add(terminator);
    }
  }
  int numLabelsLeftToTrain=numClasses;
  int progressInterval=config.getInt("String_Node_Str");
  for (int i=1; i <= numIterations; i++) {
    logger.info("String_Node_Str" + i);
    MultiLabelClfDataSet trainBatch=minibatch(allTrainData,config.getInt("String_Node_Str"));
    IMLGBConfig imlgbConfig=new IMLGBConfig.Builder(trainBatch).learningRate(learningRate).minDataPerLeaf(minDataPerLeaf).numLeaves(numLeaves).numSplitIntervals(config.getInt("String_Node_Str")).usePrior(config.getBoolean("String_Node_Str")).build();
    IMLGBTrainer trainer=new IMLGBTrainer(imlgbConfig,boosting);
    trainer.iterateWithoutStagingScores(shouldStop);
    if (config.getBoolean("String_Node_Str") && (i % progressInterval == 0 || i == numIterations)) {
      logger.info("String_Node_Str");
      logger.info(new MLMeasures(boosting,allTrainData).toString());
    }
    if (config.getBoolean("String_Node_Str") && (i % progressInterval == 0 || i == numIterations)) {
      logger.info("String_Node_Str");
      logger.info(new MLMeasures(boosting,testSet).toString());
      if (earlyStop) {
        for (int l=0; l < numClasses; l++) {
          EarlyStopper earlyStopper=earlyStoppers.get(l);
          Terminator terminator=terminators.get(l);
          if (!shouldStop[l]) {
            double kl=KL(boosting,testSet,l);
            earlyStopper.add(i,kl);
            terminator.add(kl);
            if (earlyStopper.shouldStop() || terminator.shouldTerminate()) {
              logger.info("String_Node_Str" + l + "String_Node_Str"+ allTrainData.getLabelTranslator().toExtLabel(l)+ "String_Node_Str");
              logger.info("String_Node_Str" + earlyStopper.getBestIteration());
              shouldStop[l]=true;
              numLabelsLeftToTrain-=1;
              logger.info("String_Node_Str" + numLabelsLeftToTrain);
            }
          }
        }
      }
    }
    if (numLabelsLeftToTrain == 0) {
      logger.info("String_Node_Str");
      break;
    }
  }
  logger.info("String_Node_Str");
  File serializedModel=new File(output,modelName);
  boosting.serialize(serializedModel);
  logger.info(stopWatch.toString());
  if (earlyStop) {
    for (int l=0; l < numClasses; l++) {
      logger.info("String_Node_Str");
      logger.info("String_Node_Str" + l + "String_Node_Str"+ earlyStoppers.get(l).history());
      logger.info("String_Node_Str" + l + "String_Node_Str"+ (boosting.getRegressors(l).size() - 1));
    }
  }
  boolean topFeaturesToFile=true;
  if (topFeaturesToFile) {
    logger.info("String_Node_Str");
    int limit=config.getInt("String_Node_Str");
    List<TopFeatures> topFeaturesList=IntStream.range(0,boosting.getNumClasses()).mapToObj(k -> IMLGBInspector.topFeatures(boosting,k,limit)).collect(Collectors.toList());
    ObjectMapper mapper=new ObjectMapper();
    String file="String_Node_Str";
    mapper.writeValue(new File(output,file),topFeaturesList);
    StringBuilder sb=new StringBuilder();
    for (int l=0; l < boosting.getNumClasses(); l++) {
      sb.append("String_Node_Str").append("String_Node_Str");
      sb.append(allTrainData.getLabelTranslator().toExtLabel(l)).append("String_Node_Str").append("String_Node_Str");
      for (      Feature feature : topFeaturesList.get(l).getTopFeatures()) {
        sb.append(feature.simpleString()).append("String_Node_Str");
      }
      sb.append("String_Node_Str");
    }
    FileUtils.writeStringToFile(new File(output,"String_Node_Str"),sb.toString());
    logger.info("String_Node_Str");
  }
}

Fixed version (ground truth):
static void train(Config config,Logger logger) throws Exception {
  String output=config.getString("String_Node_Str");
  int numIterations=config.getInt("String_Node_Str");
  int numLeaves=config.getInt("String_Node_Str");
  double learningRate=config.getDouble("String_Node_Str");
  int minDataPerLeaf=config.getInt("String_Node_Str");
  String modelName="String_Node_Str";
  StopWatch stopWatch=new StopWatch();
  stopWatch.start();
  MultiLabelClfDataSet allTrainData=loadData(config,config.getString("String_Node_Str"));
  MultiLabelClfDataSet testSet=null;
  if (config.getBoolean("String_Node_Str")) {
    testSet=loadData(config,config.getString("String_Node_Str"));
  }
  int numClasses=allTrainData.getNumClasses();
  logger.info("String_Node_Str" + numClasses);
  IMLGradientBoosting boosting;
  if (config.getBoolean("String_Node_Str")) {
    boosting=IMLGradientBoosting.deserialize(new File(output,modelName));
  }
 else {
    boosting=new IMLGradientBoosting(numClasses);
  }
  List<MultiLabel> allAssignments=DataSetUtil.gatherMultiLabels(allTrainData);
  boosting.setAssignments(allAssignments);
  logger.info("String_Node_Str");
  boolean earlyStop=config.getBoolean("String_Node_Str");
  List<EarlyStopper> earlyStoppers=new ArrayList<>();
  List<Terminator> terminators=new ArrayList<>();
  boolean[] shouldStop=new boolean[allTrainData.getNumClasses()];
  if (earlyStop) {
    for (int l=0; l < numClasses; l++) {
      EarlyStopper earlyStopper=new EarlyStopper(EarlyStopper.Goal.MINIMIZE,config.getInt("String_Node_Str"));
      earlyStopper.setMinimumIterations(config.getInt("String_Node_Str"));
      earlyStoppers.add(earlyStopper);
    }
    for (int l=0; l < numClasses; l++) {
      Terminator terminator=new Terminator();
      terminator.setMaxStableIterations(config.getInt("String_Node_Str")).setMinIterations(config.getInt("String_Node_Str") / config.getInt("String_Node_Str")).setAbsoluteEpsilon(config.getDouble("String_Node_Str")).setRelativeEpsilon(config.getDouble("String_Node_Str")).setOperation(Terminator.Operation.OR);
      terminators.add(terminator);
    }
  }
  int numLabelsLeftToTrain=numClasses;
  int progressInterval=config.getInt("String_Node_Str");
  for (int i=1; i <= numIterations; i++) {
    logger.info("String_Node_Str" + i);
    MultiLabelClfDataSet trainBatch=minibatch(allTrainData,config.getInt("String_Node_Str"));
    IMLGBConfig imlgbConfig=new IMLGBConfig.Builder(trainBatch).learningRate(learningRate).minDataPerLeaf(minDataPerLeaf).numLeaves(numLeaves).numSplitIntervals(config.getInt("String_Node_Str")).usePrior(config.getBoolean("String_Node_Str")).build();
    IMLGBTrainer trainer=new IMLGBTrainer(imlgbConfig,boosting);
    trainer.iterateWithoutStagingScores(shouldStop);
    if (config.getBoolean("String_Node_Str") && (i % progressInterval == 0 || i == numIterations)) {
      logger.info("String_Node_Str");
      logger.info(new MLMeasures(boosting,allTrainData).toString());
    }
    if (config.getBoolean("String_Node_Str") && (i % progressInterval == 0 || i == numIterations)) {
      logger.info("String_Node_Str");
      logger.info(new MLMeasures(boosting,testSet).toString());
      if (earlyStop) {
        for (int l=0; l < numClasses; l++) {
          EarlyStopper earlyStopper=earlyStoppers.get(l);
          Terminator terminator=terminators.get(l);
          if (!shouldStop[l]) {
            double kl=KL(boosting,testSet,l);
            earlyStopper.add(i,kl);
            terminator.add(kl);
            if (earlyStopper.shouldStop() || terminator.shouldTerminate()) {
              logger.info("String_Node_Str" + l + "String_Node_Str"+ allTrainData.getLabelTranslator().toExtLabel(l)+ "String_Node_Str");
              logger.info("String_Node_Str" + earlyStopper.getBestIteration());
              shouldStop[l]=true;
              numLabelsLeftToTrain-=1;
              logger.info("String_Node_Str" + numLabelsLeftToTrain);
            }
          }
        }
      }
    }
    if (numLabelsLeftToTrain == 0) {
      logger.info("String_Node_Str");
      break;
    }
  }
  logger.info("String_Node_Str");
  File serializedModel=new File(output,modelName);
  boosting.serialize(serializedModel);
  logger.info(stopWatch.toString());
  if (earlyStop) {
    for (int l=0; l < numClasses; l++) {
      logger.info("String_Node_Str");
      logger.info("String_Node_Str" + l + "String_Node_Str"+ earlyStoppers.get(l).history());
      logger.info("String_Node_Str" + l + "String_Node_Str"+ (boosting.getRegressors(l).size() - 1));
    }
  }
  boolean topFeaturesToFile=true;
  if (topFeaturesToFile) {
    logger.info("String_Node_Str");
    int limit=config.getInt("String_Node_Str");
    List<TopFeatures> topFeaturesList=IntStream.range(0,boosting.getNumClasses()).mapToObj(k -> IMLGBInspector.topFeatures(boosting,k,limit)).collect(Collectors.toList());
    ObjectMapper mapper=new ObjectMapper();
    String file="String_Node_Str";
    mapper.writeValue(new File(output,file),topFeaturesList);
    StringBuilder sb=new StringBuilder();
    for (int l=0; l < boosting.getNumClasses(); l++) {
      sb.append("String_Node_Str").append("String_Node_Str");
      sb.append(allTrainData.getLabelTranslator().toExtLabel(l)).append("String_Node_Str").append("String_Node_Str");
      for (      Feature feature : topFeaturesList.get(l).getTopFeatures()) {
        sb.append(feature.simpleString()).append("String_Node_Str");
      }
      sb.append("String_Node_Str");
    }
    FileUtils.writeStringToFile(new File(output,"String_Node_Str"),sb.toString());
    logger.info("String_Node_Str");
  }
}