nus-yam/ex-repair huggingface dataset:
Program: 31633
Project: 31633
Buggy source:
public static BasicUpdater getUpdater(ModelConfig modelConfig,ModelInspector.ModelStep step) throws IOException {
  BasicUpdater updater=null;
switch (step) {
case INIT:
case STATS:
    updater=new BasicUpdater(modelConfig);
  break;
case VARSELECT:
updater=new VarSelUpdater(modelConfig);
break;
case TRAIN:
updater=new TrainUpdater(modelConfig);
break;
default :
updater=new VoidUpdater(modelConfig);
break;
}
return updater;
}

Fixed version (ground truth):
public static BasicUpdater getUpdater(ModelConfig modelConfig,ModelInspector.ModelStep step) throws IOException {
  BasicUpdater updater=null;
switch (step) {
case INIT:
case STATS:
case NORMALIZE:
    updater=new BasicUpdater(modelConfig);
  break;
case VARSELECT:
updater=new VarSelUpdater(modelConfig);
break;
case TRAIN:
updater=new TrainUpdater(modelConfig);
break;
default :
updater=new VoidUpdater(modelConfig);
break;
}
return updater;
}
Program: 31635
Project: 31635
Buggy source:
@Override protected void reduce(IntWritable key,Iterable<CorrelationWritable> values,Context context) throws IOException, InterruptedException {
  CorrelationWritable finalCw=null;
  Iterator<CorrelationWritable> cwIt=values.iterator();
  while (cwIt.hasNext()) {
    CorrelationWritable cw=cwIt.next();
    if (finalCw == null) {
      finalCw=cw;
    }
 else {
      finalCw.combine(cw);
    }
  }
  this.outputKey.set(key.get());
  this.outputValue.set(new String(Base64.encodeBase64(objectToBytes(finalCw)),"String_Node_Str"));
  context.write(outputKey,outputValue);
}

Fixed version (ground truth):
@Override protected void reduce(IntWritable key,Iterable<CorrelationWritable> values,Context context) throws IOException, InterruptedException {
  CorrelationWritable finalCw=initCw();
  Iterator<CorrelationWritable> cwIt=values.iterator();
  while (cwIt.hasNext()) {
    CorrelationWritable cw=cwIt.next();
    finalCw.setColumnIndex(cw.getColumnIndex());
    finalCw.combine(cw);
  }
  this.outputKey.set(key.get());
  this.outputValue.set(new String(Base64.encodeBase64(objectToBytes(finalCw)),"String_Node_Str"));
  context.write(outputKey,outputValue);
}
Program: 31636
Project: 31636
Buggy source:
/** 
 * Do initialization like ModelConfig and ColumnConfig loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  this.outputKey=new IntWritable();
  this.outputValue=new Text();
}

Fixed version (ground truth):
/** 
 * Do initialization like ModelConfig and ColumnConfig loading.
 */
@Override protected void setup(Context context) throws IOException, InterruptedException {
  this.outputKey=new IntWritable();
  this.outputValue=new Text();
  loadConfigFiles(context);
}
Program: 31638
Project: 31638
Buggy source:
private void autoCheckShuffleAndShuffleSize() throws IOException {
  ColumnConfig targetColumnConfig=CommonUtils.findTargetColumn(columnConfigList);
  long totalCount=targetColumnConfig.getTotalCount();
  int filePartCnt=ShifuFileUtils.getFilePartCount(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  if (filePartCnt > 0 && filePartCnt <= CommonConstants.PART_FILE_COUNT_THRESHOLD && totalCount * 1.0d / filePartCnt >= CommonConstants.MAX_RECORDS_PER_WORKER && ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS)) {
    long shuffleSize=totalCount / CommonConstants.MAX_RECORDS_PER_WORKER;
    log.info("String_Node_Str",shuffleSize);
    this.isToShuffleData=true;
    Integer shuffleSizeInteger=Environment.getInt(Constants.SHIFU_NORM_SHUFFLE_SIZE);
    if (shuffleSizeInteger == null) {
      Environment.setProperty(Constants.SHIFU_NORM_SHUFFLE_SIZE,shuffleSize + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void autoCheckShuffleAndShuffleSize() throws IOException {
  ColumnConfig targetColumnConfig=CommonUtils.findTargetColumn(columnConfigList);
  Long totalCount=targetColumnConfig.getTotalCount();
  if (totalCount == null) {
    return;
  }
  int filePartCnt=ShifuFileUtils.getFilePartCount(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  if (filePartCnt > 0 && filePartCnt <= CommonConstants.PART_FILE_COUNT_THRESHOLD && totalCount * 1.0d / filePartCnt >= CommonConstants.MAX_RECORDS_PER_WORKER && ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS)) {
    long shuffleSize=totalCount / CommonConstants.MAX_RECORDS_PER_WORKER;
    log.info("String_Node_Str",shuffleSize);
    this.isToShuffleData=true;
    Integer shuffleSizeInteger=Environment.getInt(Constants.SHIFU_NORM_SHUFFLE_SIZE);
    if (shuffleSizeInteger == null) {
      Environment.setProperty(Constants.SHIFU_NORM_SHUFFLE_SIZE,shuffleSize + "String_Node_Str");
    }
  }
}
Program: 31639
Project: 31639
Buggy source:
/** 
 * runner for normalization data
 */
@Override public int run() throws Exception {
  log.info("String_Node_Str");
  long start=System.currentTimeMillis();
  try {
    setUp(ModelStep.NORMALIZE);
    syncDataToHdfs(modelConfig.getDataSet().getSource());
switch (modelConfig.getBasic().getRunMode()) {
case DIST:
case MAPRED:
      runPigNormalize();
    autoCheckShuffleAndShuffleSize();
  if (this.isToShuffleData) {
    MapReduceShuffle shuffler=new MapReduceShuffle(this.modelConfig);
    shuffler.run(this.pathFinder.getNormalizedDataPath());
  }
if (CommonUtils.isTreeModel(modelConfig.getAlgorithm())) {
  runDataClean(this.isToShuffleData);
}
break;
case LOCAL:
runAkkaNormalize();
break;
}
syncDataToHdfs(modelConfig.getDataSet().getSource());
clearUp(ModelStep.NORMALIZE);
}
 catch (Exception e) {
log.error("String_Node_Str",e);
return -1;
}
log.info("String_Node_Str",(System.currentTimeMillis() - start));
return 0;
}

Fixed version (ground truth):
/** 
 * runner for normalization data
 */
@Override public int run() throws Exception {
  log.info("String_Node_Str");
  long start=System.currentTimeMillis();
  try {
    setUp(ModelStep.NORMALIZE);
    syncDataToHdfs(modelConfig.getDataSet().getSource());
switch (modelConfig.getBasic().getRunMode()) {
case DIST:
case MAPRED:
      runPigNormalize();
    try {
      autoCheckShuffleAndShuffleSize();
    }
 catch (    Exception e) {
      log.warn("String_Node_Str",e);
    }
  if (this.isToShuffleData) {
    MapReduceShuffle shuffler=new MapReduceShuffle(this.modelConfig);
    shuffler.run(this.pathFinder.getNormalizedDataPath());
  }
if (CommonUtils.isTreeModel(modelConfig.getAlgorithm())) {
  runDataClean(this.isToShuffleData);
}
break;
case LOCAL:
runAkkaNormalize();
break;
}
syncDataToHdfs(modelConfig.getDataSet().getSource());
clearUp(ModelStep.NORMALIZE);
}
 catch (Exception e) {
log.error("String_Node_Str",e);
return -1;
}
log.info("String_Node_Str",(System.currentTimeMillis() - start));
return 0;
}
Program: 31640
Project: 31640
Buggy source:
/** 
 * Create the normalized output for model, since the final score should be 0 ~ 1000, instead of 0.o ~ 1.0
 * @return output for model
 */
protected Output createNormalizedOutput(int id){
  Output output=new Output();
  output.withOutputFields(createOutputField(RAW_RESULT + "String_Node_Str" + id,OpType.CONTINUOUS,DataType.DOUBLE,ResultFeatureType.PREDICTED_VALUE));
  OutputField finalResult=createOutputField(FINAL_RESULT + "String_Node_Str" + id,OpType.CONTINUOUS,DataType.DOUBLE,ResultFeatureType.TRANSFORMED_VALUE);
  finalResult.withExpression(createApplyFunc(id));
  output.withOutputFields(finalResult);
  return output;
}

Fixed version (ground truth):
/** 
 * Create the normalized output for model, since the final score should be 0 ~ 1000, instead of 0.o ~ 1.0
 * @return output for model
 */
protected Output createNormalizedOutput(int id){
  Output output=new Output();
  output.withOutputFields(createOutputField(RAW_RESULT + "String_Node_Str" + id,OpType.CONTINUOUS,DataType.DOUBLE,ResultFeatureType.PREDICTED_VALUE));
  OutputField finalResult=createOutputField(FINAL_RESULT + "String_Node_Str" + id,OpType.CONTINUOUS,DataType.DOUBLE,ResultFeatureType.TRANSFORMED_VALUE);
  finalResult.withExpression(createNormExpr(id));
  output.withOutputFields(finalResult);
  return output;
}
Program: 31643
Project: 31643
Buggy source:
private long computeDynamicCombineSize() throws IOException {
  int filePartCnt=ShifuFileUtils.getFilePartCount(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long actualFileSize=ShifuFileUtils.getFileOrDirectorySize(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  boolean isGzip=ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long avgFileSize=actualFileSize / filePartCnt;
  if (isGzip && filePartCnt <= 20) {
    return (long)(avgFileSize * 1.2d);
  }
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  int candidateCount=inputOutputIndex[2];
  long maxCombineSize=CommonUtils.isTreeModel(modelConfig.getAlgorithm()) ? 209715200L : 168435456L;
  double ratio=candidateCount / 600d;
  if (ratio > 2d) {
    ratio=0.85 * ratio;
  }
  long finalCombineSize=Double.valueOf((maxCombineSize * 1d * (ratio))).longValue();
  if (actualFileSize / finalCombineSize < 25) {
    finalCombineSize/=2;
  }
  return finalCombineSize;
}

Fixed version (ground truth):
private long computeDynamicCombineSize() throws IOException {
  int filePartCnt=ShifuFileUtils.getFilePartCount(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long actualFileSize=ShifuFileUtils.getFileOrDirectorySize(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  boolean isGzip=ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long avgFileSize=actualFileSize / filePartCnt;
  if (isGzip && filePartCnt <= 20) {
    return (long)(avgFileSize * 1.2d);
  }
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  int candidateCount=inputOutputIndex[2];
  long maxCombineSize=CommonUtils.isTreeModel(modelConfig.getAlgorithm()) ? 209715200L : 168435456L;
  if (modelConfig.isClassification()) {
    return maxCombineSize;
  }
  double ratio=candidateCount / 600d;
  if (ratio > 2d) {
    ratio=0.85 * ratio;
  }
  long finalCombineSize=Double.valueOf((maxCombineSize * 1d * (ratio))).longValue();
  if (actualFileSize / finalCombineSize < 25) {
    finalCombineSize/=2;
  }
  return finalCombineSize;
}
Program: 31644
Project: 31644
Buggy source:
private long computeDynamicCombineSize() throws IOException {
  int filePartCnt=ShifuFileUtils.getFilePartCount(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long actualFileSize=ShifuFileUtils.getFileOrDirectorySize(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  boolean isGzip=ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long avgFileSize=actualFileSize / filePartCnt;
  if (isGzip && filePartCnt <= 20) {
    return (long)(avgFileSize * 1.2d);
  }
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  int candidateCount=inputOutputIndex[2];
  long maxCombineSize=CommonUtils.isTreeModel(modelConfig.getAlgorithm()) ? 209715200L : 168435456L;
  if (modelConfig.isClassification()) {
    return maxCombineSize;
  }
  double ratio=candidateCount / 600d;
  if (ratio > 2d) {
    ratio=0.85 * ratio;
  }
  long finalCombineSize=Double.valueOf((maxCombineSize * 1d * (ratio))).longValue();
  if (actualFileSize / finalCombineSize < 25) {
    finalCombineSize/=2;
  }
  return finalCombineSize;
}

Fixed version (ground truth):
private long computeDynamicCombineSize() throws IOException {
  int filePartCnt=ShifuFileUtils.getFilePartCount(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long actualFileSize=ShifuFileUtils.getFileOrDirectorySize(super.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  boolean isGzip=ShifuFileUtils.isPartFileAllGzip(this.pathFinder.getNormalizedDataPath(),SourceType.HDFS);
  long avgFileSize=actualFileSize / filePartCnt;
  if (isGzip && filePartCnt <= 20) {
    return (long)(avgFileSize * 1.2d);
  }
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  int candidateCount=inputOutputIndex[2];
  long maxCombineSize=CommonUtils.isTreeModel(modelConfig.getAlgorithm()) ? 209715200L : 168435456L;
  if (modelConfig.isClassification()) {
    return maxCombineSize;
  }
  double ratio=candidateCount / 600d;
  if (ratio > 2d) {
    ratio=0.85 * ratio;
  }
  long finalCombineSize=Double.valueOf((maxCombineSize * 1d * (ratio))).longValue();
  if (finalCombineSize != 0L && actualFileSize / finalCombineSize < 25) {
    finalCombineSize/=2;
  }
  return finalCombineSize;
}
Program: 31646
Project: 31646
Buggy source:
/** 
 * Load model configuration from the path and the source type.
 * @param path model file path
 * @param sourceType source type of model file
 * @return model config instance
 * @throws IOException if any IO exception in parsing json.
 * @throws IllegalArgumentException if  {@code path} is null or empty, if sourceType is null.
 */
public static ModelConfig loadModelConfig(String path,SourceType sourceType) throws IOException {
  ModelConfig modelConfig=loadJSON(path,sourceType,ModelConfig.class);
  if (modelConfig.getTrain().getGridConfigFile() != null) {
    modelConfig.getTrain().setGridConfigFileContent(loadFileContent(path,sourceType));
  }
  return modelConfig;
}

Fixed version (ground truth):
/** 
 * Load model configuration from the path and the source type.
 * @param path model file path
 * @param sourceType source type of model file
 * @return model config instance
 * @throws IOException if any IO exception in parsing json.
 * @throws IllegalArgumentException if  {@code path} is null or empty, if sourceType is null.
 */
public static ModelConfig loadModelConfig(String path,SourceType sourceType) throws IOException {
  ModelConfig modelConfig=loadJSON(path,sourceType,ModelConfig.class);
  if (modelConfig.getTrain().getGridConfigFile() != null) {
    modelConfig.getTrain().setGridConfigFileContent(loadFileContent(modelConfig.getTrain().getGridConfigFile(),sourceType));
  }
  return modelConfig;
}
Program: 31647
Project: 31647
Buggy source:
/** 
 * Run evaluation per EvalConfig.
 * @param evalConfig the evaluation config instance.
 * @throws IOException when any IO exception
 */
private void runEval(EvalConfig evalConfig) throws IOException {
  validateEvalColumnConfig(evalConfig);
  String evalSetPath=pathFinder.getEvalSetPath(evalConfig,SourceType.LOCAL);
  FileUtils.forceMkdir(new File(evalSetPath));
  syncDataToHdfs(evalConfig.getDataSet().getSource());
switch (modelConfig.getBasic().getRunMode()) {
case DIST:
case MAPRED:
    runDistEval(evalConfig);
  break;
case LOCAL:
runAkkaEval(evalConfig);
break;
default :
break;
}
}

Fixed version (ground truth):
/** 
 * Run evaluation per EvalConfig.
 * @param evalConfig the evaluation config instance.
 * @throws IOException when any IO exception
 */
private void runEval(EvalConfig evalConfig) throws IOException {
synchronized (this) {
    validateEvalColumnConfig(evalConfig);
    String evalSetPath=pathFinder.getEvalSetPath(evalConfig,SourceType.LOCAL);
    FileUtils.forceMkdir(new File(evalSetPath));
    syncDataToHdfs(evalConfig.getDataSet().getSource());
  }
switch (modelConfig.getBasic().getRunMode()) {
case DIST:
case MAPRED:
    runDistEval(evalConfig);
  break;
case LOCAL:
runAkkaEval(evalConfig);
break;
default :
break;
}
}
Program: 31648
Project: 31648
Buggy source:
private Tuple buildTuple(Tuple input,TupleFactory tupleFactory,String tag,int i,int finalIndex,DataPurifier dataPurifier) throws ExecException {
  if (dataPurifier != null) {
    Boolean isFilter=dataPurifier.isFilter(input);
    if (!isFilter) {
      return null;
    }
  }
  Tuple tuple=tupleFactory.newTuple(TOTAL_COLUMN_CNT);
  tuple.set(COLUMN_ID_INDX,finalIndex);
  tuple.set(COLUMN_VAL_INDX,(input.get(i) == null ? null : input.get(i).toString()));
  if (modelConfig.isRegression()) {
    if (super.posTagSet.contains(tag)) {
      tuple.set(COLUMN_TAG_INDX,true);
    }
    if (super.negTagSet.contains(tag)) {
      tuple.set(COLUMN_TAG_INDX,false);
    }
  }
 else {
    tuple.set(COLUMN_TAG_INDX,true);
  }
  tuple.set(COLUMN_WEIGHT_INDX,getWeightColumnVal(input));
  if (this.isAppendRandom) {
    tuple.set(COLUMN_SEED_INDX,Math.abs(random.nextInt() % 300));
  }
  return tuple;
}

Fixed version (ground truth):
private Tuple buildTuple(Tuple input,TupleFactory tupleFactory,String tag,int i,int finalIndex) throws ExecException {
  Tuple tuple=tupleFactory.newTuple(TOTAL_COLUMN_CNT);
  tuple.set(COLUMN_ID_INDX,finalIndex);
  tuple.set(COLUMN_VAL_INDX,(input.get(i) == null ? null : input.get(i).toString()));
  if (modelConfig.isRegression()) {
    if (super.posTagSet.contains(tag)) {
      tuple.set(COLUMN_TAG_INDX,true);
    }
    if (super.negTagSet.contains(tag)) {
      tuple.set(COLUMN_TAG_INDX,false);
    }
  }
 else {
    tuple.set(COLUMN_TAG_INDX,true);
  }
  tuple.set(COLUMN_WEIGHT_INDX,getWeightColumnVal(input));
  if (this.isAppendRandom) {
    tuple.set(COLUMN_SEED_INDX,Math.abs(random.nextInt() % 300));
  }
  return tuple;
}
Program: 31649
Project: 31649
Buggy source:
public AddColumnNumAndFilterUDF(String source,String pathModelConfig,String pathColumnConfig,String withScoreStr,String isAppendRandom) throws Exception {
  super(source,pathModelConfig,pathColumnConfig,withScoreStr);
  this.isAppendRandom=Boolean.TRUE.toString().equalsIgnoreCase(isAppendRandom);
  String filterExpressions="String_Node_Str";
  if (UDFContext.getUDFContext() != null && UDFContext.getUDFContext().getJobConf() != null) {
    filterExpressions=UDFContext.getUDFContext().getJobConf().get("String_Node_Str");
  }
 else {
    filterExpressions=Environment.getProperty("String_Node_Str");
  }
  if (StringUtils.isNotBlank(filterExpressions)) {
    this.isForExpressions=true;
    String[] splits=CommonUtils.split(filterExpressions,Constants.SHIFU_STATS_FILTER_EXPRESSIONS_DELIMETER);
    this.dataPurifiers=new ArrayList<DataPurifier>(splits.length);
    for (    String split : splits) {
      this.dataPurifiers.add(new DataPurifier(modelConfig,split));
    }
  }
}

Fixed version (ground truth):
public AddColumnNumAndFilterUDF(String source,String pathModelConfig,String pathColumnConfig,String withScoreStr,String isAppendRandom,String filterExpressions) throws Exception {
  super(source,pathModelConfig,pathColumnConfig,withScoreStr);
  this.isAppendRandom=Boolean.TRUE.toString().equalsIgnoreCase(isAppendRandom);
  log.info("String_Node_Str" + pathColumnConfig + "String_Node_Str"+ filterExpressions);
  if (UDFContext.getUDFContext() != null && UDFContext.getUDFContext().getJobConf() != null) {
    filterExpressions=UDFContext.getUDFContext().getJobConf().get("String_Node_Str");
  }
 else {
    filterExpressions=Environment.getProperty("String_Node_Str");
  }
  if (StringUtils.isNotBlank(filterExpressions)) {
    this.isForExpressions=true;
    String[] splits=CommonUtils.split(filterExpressions,Constants.SHIFU_STATS_FILTER_EXPRESSIONS_DELIMETER);
    this.dataPurifiers=new ArrayList<DataPurifier>(splits.length);
    for (    String split : splits) {
      this.dataPurifiers.add(new DataPurifier(modelConfig,split));
    }
    log.info("String_Node_Str" + filterExpressions + "String_Node_Str"+ dataPurifiers.size());
  }
}
Program: 31651
Project: 31651
Buggy source:
public TrainUpdater(ModelConfig modelConfig) throws IOException {
  super(modelConfig);
}

Fixed version (ground truth):
public TrainUpdater(ModelConfig modelConfig) throws IOException {
  super(modelConfig);
  segs=modelConfig.getSegmentFilterExpressions();
  if (segs.size() > 0) {
    this.isForSegs=true;
  }
  this.setMeta=new HashSet<NSColumn>();
  if (CollectionUtils.isNotEmpty(modelConfig.getMetaColumnNames())) {
    for (    String meta : modelConfig.getMetaColumnNames()) {
      setMeta.add(new NSColumn(meta));
      if (this.isForSegs) {
        for (int i=0; i < segs.size(); i++) {
          setMeta.add(new NSColumn(meta + "String_Node_Str" + (i + 1)));
        }
      }
    }
  }
  setHybridColumns=new HashSet<NSColumn>();
  hybridColumnNames=modelConfig.getHybridColumnNames();
  if (hybridColumnNames != null && hybridColumnNames.size() > 0) {
    for (    Entry<String,Double> entry : hybridColumnNames.entrySet()) {
      setHybridColumns.add(new NSColumn(entry.getKey()));
      if (this.isForSegs) {
        for (int i=0; i < segs.size(); i++) {
          setHybridColumns.add(new NSColumn(entry.getKey() + "String_Node_Str" + (i + 1)));
        }
      }
    }
  }
}
Program: 31652
Project: 31652
Buggy source:
public VarSelUpdater(ModelConfig modelConfig) throws IOException {
  super(modelConfig);
}

Fixed version (ground truth):
public VarSelUpdater(ModelConfig modelConfig) throws IOException {
  super(modelConfig);
  segs=modelConfig.getSegmentFilterExpressions();
  if (segs.size() > 0) {
    this.isForSegs=true;
  }
  this.setMeta=new HashSet<NSColumn>();
  if (CollectionUtils.isNotEmpty(modelConfig.getMetaColumnNames())) {
    for (    String meta : modelConfig.getMetaColumnNames()) {
      setMeta.add(new NSColumn(meta));
      if (this.isForSegs) {
        for (int i=0; i < segs.size(); i++) {
          setMeta.add(new NSColumn(meta + "String_Node_Str" + (i + 1)));
        }
      }
    }
  }
  setHybridColumns=new HashSet<NSColumn>();
  hybridColumnNames=modelConfig.getHybridColumnNames();
  if (hybridColumnNames != null && hybridColumnNames.size() > 0) {
    for (    Entry<String,Double> entry : hybridColumnNames.entrySet()) {
      setHybridColumns.add(new NSColumn(entry.getKey()));
      if (this.isForSegs) {
        for (int i=0; i < segs.size(); i++) {
          setHybridColumns.add(new NSColumn(entry.getKey() + "String_Node_Str" + (i + 1)));
        }
      }
    }
  }
}
Program: 31657
Project: 31657
Buggy source:
/** 
 * Save tmp model to HDFS.
 */
private void saveTmpModelToHDFS(int iteration,List<TreeNode> trees){
  Path out=new Path(DTrainUtils.getTmpModelName(this.tmpModelsFolder,this.trainerId,iteration,modelConfig.getTrain().getAlgorithm().toLowerCase()));
  writeModelToFileSystem(trees,out);
}

Fixed version (ground truth):
/** 
 * Save tmp model to HDFS.
 */
private void saveTmpModelToHDFS(int iteration,List<TreeNode> trees){
  Path out=getTmpModelPath(iteration);
  writeModelToFileSystem(trees,out);
}
Program: 31659
Project: 31659
Buggy source:
@Override public void run(){
  List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  if (!isHalt && currentIteration != totalIteration) {
    writeModelToFileSystem(subTrees,out);
  }
  saveTmpModelToHDFS(subTrees.size(),subTrees);
}

Fixed version (ground truth):
@Override public void run(){
  List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  int subTreesSize=subTrees.size();
  if (!isHalt && currentIteration != totalIteration) {
    Path tmpModelPath=getTmpModelPath(subTreesSize);
    writeModelToFileSystem(subTrees,out);
    LOG.info("String_Node_Str",tmpModelPath.toString());
    try {
      DataOutputStream outputStream=new DataOutputStream(new GZIPOutputStream(FileSystem.get(DTOutput.this.conf).create(tmpModelPath)));
      FSDataInputStream inputStream=FileSystem.get(DTOutput.this.conf).open(out);
      DataInputStream dis=new DataInputStream(new GZIPInputStream(inputStream));
      IOUtils.copyBytes(dis,outputStream,DTOutput.this.conf);
    }
 catch (    IOException e) {
      LOG.warn("String_Node_Str",e);
    }
  }
 else {
    saveTmpModelToHDFS(subTreesSize,subTrees);
  }
}
Program: 31660
Project: 31660
Buggy source:
private void writeModelToFileSystem(List<TreeNode> trees,Path out){
  List<List<TreeNode>> baggingTrees=new ArrayList<List<TreeNode>>();
  baggingTrees.add(trees);
  try {
    BinaryDTSerializer.save(modelConfig,columnConfigList,baggingTrees,this.validParams.get("String_Node_Str").toString(),inputCount,FileSystem.get(new Configuration()),out);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void writeModelToFileSystem(List<TreeNode> trees,Path out){
  List<List<TreeNode>> baggingTrees=new ArrayList<List<TreeNode>>();
  baggingTrees.add(trees);
  try {
    BinaryDTSerializer.save(modelConfig,columnConfigList,baggingTrees,this.validParams.get("String_Node_Str").toString(),inputCount,FileSystem.get(this.conf),out);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 31661
Project: 31661
Buggy source:
/** 
 * Runner for evaluation
 */
@Override public int run() throws Exception {
  LOG.info("String_Node_Str");
  long start=System.currentTimeMillis();
  try {
    setUp(ModelStep.EVAL);
    syncDataToHdfs(modelConfig.getDataSet().getSource());
switch (evalStep) {
case LIST:
      listEvalSet();
    break;
case NEW:
  createNewEval(evalName);
break;
case DELETE:
deleteEvalSet(evalName);
break;
case RUN:
runEval(getEvalConfigListFromInput());
break;
case NORM:
runNormalize(getEvalConfigListFromInput());
break;
case PERF:
runPerformance(getEvalConfigListFromInput());
break;
case SCORE:
runScore(getEvalConfigListFromInput());
break;
case CONFMAT:
runConfusionMatrix(getEvalConfigListFromInput());
break;
default :
break;
}
syncDataToHdfs(modelConfig.getDataSet().getSource());
clearUp(ModelStep.EVAL);
}
 catch (Exception e) {
LOG.error("String_Node_Str",e);
return -1;
}
LOG.info("String_Node_Str",(System.currentTimeMillis() - start));
return 0;
}

Fixed version (ground truth):
@Override public void run(){
  try {
    runScore(config);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
  }
  cdl.countDown();
}
Program: 31662
Project: 31662
Buggy source:
public double[] calculateWeights(double[] weights,double[] gradients){
  for (int i=0; i < gradients.length; i++) {
    if (this.dropoutRate > 0 && this.random.nextDouble() < this.dropoutRate) {
      continue;
    }
switch (this.rl) {
case NONE:
      weights[i]+=updateWeight(i,weights,gradients);
    break;
case L1:
  if (Double.compare(this.reg,0d) == 0) {
    weights[i]+=updateWeight(i,weights,gradients);
  }
 else {
    double shrinkValue=this.reg / getNumTrainSize();
    double delta=updateWeight(i,weights,gradients);
    weights[i]+=Math.signum(delta) * Math.max(0.0,Math.abs(delta) - shrinkValue);
  }
break;
case L2:
default :
weights[i]+=(updateWeight(i,weights,gradients) - this.reg * weights[i] / getNumTrainSize());
break;
}
}
return weights;
}

Fixed version (ground truth):
public double[] calculateWeights(double[] weights,double[] gradients){
  for (int i=0; i < gradients.length; i++) {
    if (this.dropoutRate > 0 && this.random.nextDouble() < this.dropoutRate) {
      continue;
    }
switch (this.rl) {
case NONE:
      weights[i]+=updateWeight(i,weights,gradients);
    break;
case L1:
  if (Double.compare(this.reg,0d) == 0) {
    weights[i]+=updateWeight(i,weights,gradients);
  }
 else {
    double shrinkValue=this.reg / getNumTrainSize();
    double delta=updateWeight(i,weights,gradients);
    weights[i]=Math.signum(delta) * Math.max(0.0,Math.abs(delta) - shrinkValue);
  }
break;
case L2:
default :
weights[i]+=(updateWeight(i,weights,gradients) - this.reg * weights[i] / getNumTrainSize());
break;
}
}
return weights;
}
Program: 31664
Project: 31664
Buggy source:
/** 
 * Parse raw value based on ColumnConfig.
 * @param config ColumnConfig info
 * @param raw input column value
 * @param categoryMissingNormType missing categorical value norm type
 * @return parsed raw value. For categorical type, return BinPosRate. For numerical type, returncorresponding double value. For missing data, return default value using {@link Normalizer#defaultMissingValue}.
 */
private static double parseRawValue(ColumnConfig config,String raw,CategoryMissingNormType categoryMissingNormType){
  if (categoryMissingNormType == null) {
    categoryMissingNormType=CategoryMissingNormType.MEAN;
  }
  double value=0.0;
  if (config.isCategorical()) {
    int index=CommonUtils.getBinNum(config,raw);
    if (index == -1) {
switch (categoryMissingNormType) {
case POSRATE:
        value=config.getBinPosRate().get(config.getBinPosRate().size() - 1);
      break;
case MEAN:
default :
    value=defaultMissingValue(config);
  break;
}
}
 else {
Double binPosRate=config.getBinPosRate().get(index);
if (binPosRate != null) {
value=binPosRate.doubleValue();
}
 else {
switch (categoryMissingNormType) {
case POSRATE:
  value=config.getBinPosRate().get(config.getBinPosRate().size() - 1);
break;
case MEAN:
default :
value=defaultMissingValue(config);
break;
}
}
}
}
 else {
try {
value=Double.parseDouble(raw);
}
 catch (Exception e) {
log.debug("String_Node_Str" + raw + "String_Node_Str");
value=defaultMissingValue(config);
}
}
return value;
}

Fixed version (ground truth):
/** 
 * Parse raw value based on ColumnConfig.
 * @param config ColumnConfig info
 * @param raw input column value
 * @param categoryMissingNormType missing categorical value norm type
 * @return parsed raw value. For categorical type, return BinPosRate. For numerical type, returncorresponding double value. For missing data, return default value using {@link Normalizer#defaultMissingValue}.
 */
private static double parseRawValue(ColumnConfig config,String raw,CategoryMissingNormType categoryMissingNormType){
  if (categoryMissingNormType == null) {
    categoryMissingNormType=CategoryMissingNormType.POSRATE;
  }
  double value=0.0;
  if (config.isCategorical()) {
    int index=CommonUtils.getBinNum(config,raw);
    if (index == -1) {
switch (categoryMissingNormType) {
case POSRATE:
        value=config.getBinPosRate().get(config.getBinPosRate().size() - 1);
      break;
case MEAN:
default :
    value=defaultMissingValue(config);
  break;
}
}
 else {
Double binPosRate=config.getBinPosRate().get(index);
if (binPosRate != null) {
value=binPosRate.doubleValue();
}
 else {
switch (categoryMissingNormType) {
case POSRATE:
  value=config.getBinPosRate().get(config.getBinPosRate().size() - 1);
break;
case MEAN:
default :
value=defaultMissingValue(config);
break;
}
}
}
}
 else {
try {
value=Double.parseDouble(raw);
}
 catch (Exception e) {
log.debug("String_Node_Str" + raw + "String_Node_Str");
value=defaultMissingValue(config);
}
}
return value;
}
Program: 31665
Project: 31665
Buggy source:
/** 
 * Normalize the raw data, according the ColumnConfig information and normalization type. Currently, the cutoff value doesn't affect the computation of WOE or WEIGHT_WOE type. <p> Noticed: currently OLD_ZSCALE and ZSCALE is implemented with the same process method. </p>
 * @param config ColumnConfig to normalize data
 * @param raw raw input data
 * @param cutoff standard deviation cut off
 * @param type normalization type of ModelNormalizeConf.NormType
 * @return normalized value. If normType parameter is invalid, then the ZSCALE will be used as default.
 */
public static Double normalize(ColumnConfig config,String raw,Double cutoff,ModelNormalizeConf.NormType type){
  return normalize(config,raw,cutoff,type,CategoryMissingNormType.MEAN);
}

Fixed version (ground truth):
/** 
 * Normalize the raw data, according the ColumnConfig information and normalization type. Currently, the cutoff value doesn't affect the computation of WOE or WEIGHT_WOE type. <p> Noticed: currently OLD_ZSCALE and ZSCALE is implemented with the same process method. </p>
 * @param config ColumnConfig to normalize data
 * @param raw raw input data
 * @param cutoff standard deviation cut off
 * @param type normalization type of ModelNormalizeConf.NormType
 * @return normalized value. If normType parameter is invalid, then the ZSCALE will be used as default.
 */
public static Double normalize(ColumnConfig config,String raw,Double cutoff,ModelNormalizeConf.NormType type){
  return normalize(config,raw,cutoff,type,CategoryMissingNormType.POSRATE);
}
Program: 31666
Project: 31666
Buggy source:
/** 
 * Compute the normalized data for @NormalizeMethod.Zscore
 * @param config ColumnConfig info
 * @param raw input column value
 * @param cutoff standard deviation cut off
 * @return normalized value for ZScore method.
 */
private static Double zScoreNormalize(ColumnConfig config,String raw,Double cutoff){
  double stdDevCutOff=checkCutOff(cutoff);
  double value=parseRawValue(config,raw,CategoryMissingNormType.MEAN);
  return computeZScore(value,config.getMean(),config.getStdDev(),stdDevCutOff);
}

Fixed version (ground truth):
/** 
 * Compute the normalized data for @NormalizeMethod.Zscore
 * @param config ColumnConfig info
 * @param raw input column value
 * @param cutoff standard deviation cut off
 * @return normalized value for ZScore method.
 */
private static Double zScoreNormalize(ColumnConfig config,String raw,Double cutoff){
  double stdDevCutOff=checkCutOff(cutoff);
  double value=parseRawValue(config,raw,CategoryMissingNormType.POSRATE);
  return computeZScore(value,config.getMean(),config.getStdDev(),stdDevCutOff);
}
Program: 31668
Project: 31668
Buggy source:
private double getNumericalZScoreValue(Integer columnNum,Object obj){
  double rawValue=0d;
  double mean=this.numerMeanMap.get(columnNum);
  if (obj == null || obj.toString().length() == 0) {
    rawValue=defaultMissingValue(mean);
  }
 else {
    try {
      rawValue=Double.parseDouble(obj.toString());
    }
 catch (    Exception e) {
      rawValue=defaultMissingValue(mean);
    }
  }
  double stddev=this.numerStddevMap.get(columnNum);
  double cutoff=Normalizer.checkCutOff(this.cutOffMap.get(columnNum));
  return Normalizer.computeZScore(rawValue,mean,stddev,cutoff);
}

Fixed version (ground truth):
private double getNumericalZScoreValue(Integer columnNum,Object obj){
  double mean=this.numerMeanMap.get(columnNum);
  double stddev=this.numerStddevMap.get(columnNum);
  double rawValue=0d;
  if (obj == null || obj.toString().length() == 0) {
    rawValue=defaultMissingValue(mean);
  }
 else {
    try {
      rawValue=Double.parseDouble(obj.toString());
    }
 catch (    Exception e) {
      rawValue=defaultMissingValue(mean);
    }
  }
  double cutoff=Normalizer.checkCutOff(this.cutOffMap.get(columnNum));
  return Normalizer.computeZScore(rawValue,mean,stddev,cutoff);
}
Program: 31673
Project: 31673
Buggy source:
@Test public void trimNumber(){
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag(null),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void trimNumber(){
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag(null),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
}
Program: 31675
Project: 31675
Buggy source:
public void updateColumnConfig(ColumnConfig columnConfig){
  String varName=columnConfig.getColumnName();
  if (this.setMeta.contains(new NSColumn(varName))) {
    columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.Meta);
    columnConfig.setFinalSelect(false);
  }
 else   if (this.setForceRemove.contains(new NSColumn(varName))) {
    columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.ForceRemove);
    columnConfig.setFinalSelect(false);
  }
 else   if (this.setForceSelect.contains(new NSColumn(varName))) {
    if (CollectionUtils.isEmpty(this.setCandidates) || (CollectionUtils.isNotEmpty(this.setCandidates) && this.setCandidates.contains(new NSColumn(varName)))) {
      columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.ForceSelect);
      columnConfig.setFinalSelect(true);
    }
  }
}

Fixed version (ground truth):
public void updateColumnConfig(ColumnConfig columnConfig){
  String varName=columnConfig.getColumnName();
  if (this.setMeta.contains(new NSColumn(varName))) {
    columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.Meta);
    columnConfig.setFinalSelect(false);
  }
 else   if (this.setForceRemove.contains(new NSColumn(varName))) {
    columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.ForceRemove);
    columnConfig.setFinalSelect(false);
  }
 else   if (this.setForceSelect.contains(new NSColumn(varName))) {
    if (CollectionUtils.isEmpty(this.setCandidates) || (CollectionUtils.isNotEmpty(this.setCandidates) && this.setCandidates.contains(new NSColumn(varName)))) {
      columnConfig.setColumnFlag(ColumnConfig.ColumnFlag.ForceSelect);
    }
  }
}
Program: 31677
Project: 31677
Buggy source:
@Override public void run(){
  List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  writeModelToFileSystem(subTrees,out);
  saveTmpModelToHDFS(subTrees.size(),subTrees);
}

Fixed version (ground truth):
@Override public void run(){
  List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
    writeModelToFileSystem(subTrees,out);
  }
  saveTmpModelToHDFS(subTrees.size(),subTrees);
}
Program: 31680
Project: 31680
Buggy source:
@Override public void postIteration(final MasterContext<LogisticRegressionParams,LogisticRegressionParams> context){
  if (this.isDry) {
    return;
  }
  double currentError=((modelConfig.getTrain().getValidSetRate() < EPSILON) ? context.getMasterResult().getTrainError() : context.getMasterResult().getTestError());
  if (currentError < this.minTestError) {
    this.minTestError=currentError;
    this.optimizedWeights=context.getMasterResult().getParameters();
  }
  if (context.getCurrentIteration() % DTrainUtils.tmpModelFactor(context.getTotalIteration()) == 0) {
    Thread tmpNNThread=new Thread(new Runnable(){
      @Override public void run(){
        saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getParameters());
        Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
        writeModelWeightsToFileSystem(optimizedWeights,out);
      }
    }
,"String_Node_Str");
    tmpNNThread.setDaemon(true);
    tmpNNThread.start();
  }
  updateProgressLog(context);
}

Fixed version (ground truth):
@Override public void postIteration(final MasterContext<LogisticRegressionParams,LogisticRegressionParams> context){
  if (this.isDry) {
    return;
  }
  double currentError=((modelConfig.getTrain().getValidSetRate() < EPSILON) ? context.getMasterResult().getTrainError() : context.getMasterResult().getTestError());
  if (currentError < this.minTestError) {
    this.minTestError=currentError;
    this.optimizedWeights=context.getMasterResult().getParameters();
  }
  if (context.getCurrentIteration() % DTrainUtils.tmpModelFactor(context.getTotalIteration()) == 0) {
    Thread tmpNNThread=new Thread(new Runnable(){
      @Override public void run(){
        saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getParameters());
        Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
        if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
          writeModelWeightsToFileSystem(optimizedWeights,out);
        }
      }
    }
,"String_Node_Str");
    tmpNNThread.setDaemon(true);
    tmpNNThread.start();
  }
  updateProgressLog(context);
}
Program: 31681
Project: 31681
Buggy source:
@Override public void run(){
  saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getParameters());
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  writeModelWeightsToFileSystem(optimizedWeights,out);
}

Fixed version (ground truth):
@Override public void run(){
  saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getParameters());
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
    writeModelWeightsToFileSystem(optimizedWeights,out);
  }
}
Program: 31682
Project: 31682
Buggy source:
@Override public void postIteration(final MasterContext<NNParams,NNParams> context){
  if (this.isDry) {
    return;
  }
  double currentError=((modelConfig.getTrain().getValidSetRate() < EPSILON) ? context.getMasterResult().getTrainError() : context.getMasterResult().getTestError());
  if (currentError < this.minTestError) {
    this.minTestError=currentError;
    this.optimizedWeights=context.getMasterResult().getWeights();
  }
  final int tmpModelFactor=DTrainUtils.tmpModelFactor(context.getTotalIteration());
  if (context.getCurrentIteration() % tmpModelFactor == 0) {
    Thread tmpNNThread=new Thread(new Runnable(){
      @Override public void run(){
        saveTmpNNToHDFS(context.getCurrentIteration(),context.getMasterResult().getWeights());
        Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
        writeModelWeightsToFileSystem(optimizedWeights,out);
      }
    }
,"String_Node_Str");
    tmpNNThread.setDaemon(true);
    tmpNNThread.start();
  }
  updateProgressLog(context);
}

Fixed version (ground truth):
@Override public void postIteration(final MasterContext<NNParams,NNParams> context){
  if (this.isDry) {
    return;
  }
  double currentError=((modelConfig.getTrain().getValidSetRate() < EPSILON) ? context.getMasterResult().getTrainError() : context.getMasterResult().getTestError());
  if (currentError < this.minTestError) {
    this.minTestError=currentError;
    this.optimizedWeights=context.getMasterResult().getWeights();
  }
  final int tmpModelFactor=DTrainUtils.tmpModelFactor(context.getTotalIteration());
  if (context.getCurrentIteration() % tmpModelFactor == 0) {
    Thread tmpNNThread=new Thread(new Runnable(){
      @Override public void run(){
        saveTmpNNToHDFS(context.getCurrentIteration(),context.getMasterResult().getWeights());
        Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
        if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
          writeModelWeightsToFileSystem(optimizedWeights,out);
        }
      }
    }
,"String_Node_Str");
    tmpNNThread.setDaemon(true);
    tmpNNThread.start();
  }
  updateProgressLog(context);
}
Program: 31683
Project: 31683
Buggy source:
@Override public void run(){
  saveTmpNNToHDFS(context.getCurrentIteration(),context.getMasterResult().getWeights());
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  writeModelWeightsToFileSystem(optimizedWeights,out);
}

Fixed version (ground truth):
@Override public void run(){
  saveTmpNNToHDFS(context.getCurrentIteration(),context.getMasterResult().getWeights());
  Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
  if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
    writeModelWeightsToFileSystem(optimizedWeights,out);
  }
}
Program: 31685
Project: 31685
Buggy source:
@Test public void trimNumber(){
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag(null),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void trimNumber(){
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag(null),"String_Node_Str");
  Assert.assertEquals(CommonUtils.trimTag("String_Node_Str"),"String_Node_Str");
}