nus-yam/ex-repair huggingface dataset:
Program: 32186
Project: 32186
Buggy source:
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() != 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=super.columnConfigList.get(columnId);
  AbstractBinning<?> binning=null;
  if (columnConfig.isCategorical()) {
    binning=new CategoricalBinning(-1);
  }
 else {
    if (super.modelConfig.getBinningMethod().equals(BinningMethod.EqualInterval)) {
      binning=new EqualIntervalBinning(modelConfig.getStats().getMaxNumBin());
    }
 else {
      binning=new EqualPopulationBinning(modelConfig.getStats().getMaxNumBin());
    }
  }
  Iterator<Tuple> iterator=databag.iterator();
  while (iterator.hasNext()) {
    Tuple element=iterator.next();
    if (element == null || element.size() != 4) {
      continue;
    }
    Object value=element.get(1);
    if (value != null) {
      binning.addData(value.toString());
    }
  }
  Tuple output=TupleFactory.getInstance().newTuple(2);
  output.set(0,columnId);
  output.set(1,StringUtils.join(binning.getDataBin(),CalculateStatsUDF.CATEGORY_VAL_SEPARATOR));
  return output;
}

Fixed version (ground truth):
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() != 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=super.columnConfigList.get(columnId);
  AbstractBinning<?> binning=null;
  if (columnConfig.isCategorical()) {
    binning=new CategoricalBinning(-1);
  }
 else {
    if (super.modelConfig.getBinningMethod().equals(BinningMethod.EqualInterval)) {
      binning=new EqualIntervalBinning(modelConfig.getStats().getMaxNumBin());
    }
 else {
      binning=new MunroPatBinning(modelConfig.getStats().getMaxNumBin());
    }
  }
  Iterator<Tuple> iterator=databag.iterator();
  while (iterator.hasNext()) {
    Tuple element=iterator.next();
    if (element == null || element.size() != 4) {
      continue;
    }
    Object value=element.get(1);
    if (value != null) {
      binning.addData(value.toString());
    }
  }
  Tuple output=TupleFactory.getInstance().newTuple(2);
  output.set(0,columnId);
  output.set(1,StringUtils.join(binning.getDataBin(),CalculateStatsUDF.CATEGORY_VAL_SEPARATOR));
  return output;
}
Program: 32187
Project: 32187
Buggy source:
public MSEWorker(BasicNetwork network,AbstractTrainer owner,MLDataSet dataSet,int low,int high){
  this.network=network;
  this.owner=owner;
  this.dataSet=dataSet;
  this.low=low;
  this.high=high;
  this.pair=BasicMLDataPair.createPair(network.getInputCount(),network.getOutputCount());
}

Fixed version (ground truth):
public MSEWorker(BasicNetwork network,MLDataSet dataSet,int low,int high){
  this.network=network;
  this.dataSet=dataSet;
  this.low=low;
  this.high=high;
  this.pair=BasicMLDataPair.createPair(network.getInputCount(),network.getOutputCount());
  this.totalError=0.0;
}
Program: 32188
Project: 32188
Buggy source:
public void run(){
  for (int i=this.low; i <= this.high; i++) {
    this.dataSet.getRecord(i,pair);
    MLData result=this.network.compute(this.pair.getInput());
    double tmp=result.getData()[0] - this.pair.getIdeal().getData()[0];
    double mse=tmp * tmp;
    owner.report(mse);
  }
}

Fixed version (ground truth):
public void run(){
  for (int i=this.low; i <= this.high; i++) {
    this.dataSet.getRecord(i,pair);
    MLData result=this.network.compute(this.pair.getInput());
    double tmp=result.getData()[0] - this.pair.getIdeal().getData()[0];
    double mse=tmp * tmp;
    this.totalError+=mse;
  }
}
Program: 32189
Project: 32189
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String record=currentValue.getWritable().toString();
  String[] fields=CommonUtils.split(record,modelConfig.getDataSetDelimiter());
  int targetColumnId=CommonUtils.getTargetColumnNum(columnConfigList);
  String tag=StringUtils.trim(fields[targetColumnId]);
  if (this.dataPurifier.isFilterOut(record) && isPosOrNegTag(modelConfig,tag)) {
    double[] inputs=new double[this.inputNodeCount];
    double[] ideal=new double[this.outputNodeCount];
    double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
    if (this.weightColumnId >= 0) {
      try {
        significance=Double.parseDouble(fields[this.weightColumnId]);
      }
 catch (      Exception e) {
      }
    }
    ideal[0]=(this.modelConfig.getPosTags().contains(tag) ? 1.0d : 0.0d);
    int i=0;
    for (    Integer columnId : this.trainingDataSet.getDataColumnIdList()) {
      inputs[i++]=Normalizer.normalize(columnConfigList.get(columnId),fields[columnId]);
    }
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String record=currentValue.getWritable().toString();
  String[] fields=CommonUtils.split(record,modelConfig.getDataSetDelimiter());
  int targetColumnId=CommonUtils.getTargetColumnNum(columnConfigList);
  String tag=StringUtils.trim(fields[targetColumnId]);
  long posRecordCount=0;
  long totalRecordCount=0;
  if (this.dataPurifier.isFilterOut(record) && isPosOrNegTag(modelConfig,tag)) {
    totalRecordCount++;
    if (modelConfig.getPosTags().contains(tag)) {
      posRecordCount++;
    }
    double[] inputs=new double[this.inputNodeCount];
    double[] ideal=new double[this.outputNodeCount];
    double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
    if (this.weightColumnId >= 0) {
      try {
        significance=Double.parseDouble(fields[this.weightColumnId]);
      }
 catch (      Exception e) {
      }
    }
    ideal[0]=(this.modelConfig.getPosTags().contains(tag) ? 1.0d : 0.0d);
    int i=0;
    for (    Integer columnId : this.trainingDataSet.getDataColumnIdList()) {
      inputs[i++]=Normalizer.normalize(columnConfigList.get(columnId),fields[columnId]);
    }
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
  LOG.info("String_Node_Str",totalRecordCount,posRecordCount);
}
Program: 32190
Project: 32190
Buggy source:
public void generateValidateData(Set<Integer> workingColumnIdSet,double validationRate,MLDataSet trainingData,MLDataSet testingData){
  for (  TrainingRecord trainingRecord : trainingRecords) {
    MLDataPair pair=trainingRecord.toMLDataPair(dataColumnIdList,workingColumnIdSet);
    double seed=rd.nextDouble();
    if (seed > validationRate) {
      trainingData.add(pair);
    }
 else {
      testingData.add(pair);
    }
  }
}

Fixed version (ground truth):
public void generateValidateData(Set<Integer> workingColumnIdSet,double validationRate,MLDataSet trainingData,MLDataSet testingData){
  for (  TrainingRecord trainingRecord : trainingRecords) {
    MLDataPair pair=trainingRecord.toMLDataPair(dataColumnIdList,workingColumnIdSet);
    trainingData.add(pair);
  }
}
Program: 32191
Project: 32191
Buggy source:
@Override public void consumeWorkerResults(Iterable<VarSelWorkerResult> workerResults){
  int[] voteStats=new int[columnConfigList.size() + 1];
  for (  VarSelWorkerResult workerResult : workerResults) {
    for (    Integer columnId : workerResult.getColumnIdList()) {
      voteStats[columnId + 1]++;
    }
  }
  int maxVotedColumnId=-1;
  int maxVoteCount=Integer.MIN_VALUE;
  for (int i=0; i < voteStats.length; i++) {
    if (voteStats[i] > maxVoteCount) {
      maxVoteCount=voteStats[i];
      maxVotedColumnId=i;
    }
  }
  if (maxVotedColumnId > 0) {
    workingSet.add(maxVotedColumnId - 1);
  }
}

Fixed version (ground truth):
@Override public void consumeWorkerResults(Iterable<VarSelWorkerResult> workerResults){
  int[] voteStats=new int[columnConfigList.size() + 1];
  for (  VarSelWorkerResult workerResult : workerResults) {
    for (    Integer columnId : workerResult.getColumnIdList()) {
      voteStats[columnId + 1]++;
    }
  }
  int maxVotedColumnId=-1;
  int maxVoteCount=Integer.MIN_VALUE;
  for (int i=0; i < voteStats.length; i++) {
    if (voteStats[i] > maxVoteCount) {
      maxVoteCount=voteStats[i];
      maxVotedColumnId=i;
    }
  }
  LOG.info("String_Node_Str",maxVotedColumnId,maxVoteCount);
  if (maxVotedColumnId > 0) {
    workingSet.add(maxVotedColumnId - 1);
  }
}
Program: 32192
Project: 32192
Buggy source:
public WrapperMasterConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.workingSet=new HashSet<Integer>();
  this.expectVarCount=this.modelConfig.getVarSelectFilterNum();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && columnConfig.isForceSelect()) {
      workingSet.add(columnConfig.getColumnNum());
    }
  }
}

Fixed version (ground truth):
public WrapperMasterConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.workingSet=new HashSet<Integer>();
  this.expectVarCount=this.modelConfig.getVarSelectFilterNum();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && columnConfig.isForceSelect()) {
      workingSet.add(columnConfig.getColumnNum());
    }
  }
  LOG.info("String_Node_Str",expectVarCount,workingSet.size());
}
Program: 32193
Project: 32193
Buggy source:
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  System.out.println("String_Node_Str" + bestCandidate.getColumnName() + "String_Node_Str"+ minValidateError);
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}

Fixed version (ground truth):
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  LOG.info("String_Node_Str" + bestCandidate.getColumnName() + "String_Node_Str"+ minValidateError);
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}
Program: 32194
Project: 32194
Buggy source:
public MSEWorker(BasicNetwork network,AbstractTrainer owner,MLDataSet dataSet,int low,int high){
  this.network=network;
  this.owner=owner;
  this.dataSet=dataSet;
  this.low=low;
  this.high=high;
  this.pair=BasicMLDataPair.createPair(network.getInputCount(),network.getOutputCount());
}

Fixed version (ground truth):
public MSEWorker(BasicNetwork network,MLDataSet dataSet,int low,int high){
  this.network=network;
  this.dataSet=dataSet;
  this.low=low;
  this.high=high;
  this.pair=BasicMLDataPair.createPair(network.getInputCount(),network.getOutputCount());
  this.totalError=0.0;
}
Program: 32195
Project: 32195
Buggy source:
public void run(){
  for (int i=this.low; i <= this.high; i++) {
    this.dataSet.getRecord(i,pair);
    MLData result=this.network.compute(this.pair.getInput());
    double tmp=result.getData()[0] - this.pair.getIdeal().getData()[0];
    double mse=tmp * tmp;
    owner.report(mse);
  }
}

Fixed version (ground truth):
public void run(){
  for (int i=this.low; i <= this.high; i++) {
    this.dataSet.getRecord(i,pair);
    MLData result=this.network.compute(this.pair.getInput());
    double tmp=result.getData()[0] - this.pair.getIdeal().getData()[0];
    double mse=tmp * tmp;
    this.totalError+=mse;
  }
}
Program: 32196
Project: 32196
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String record=currentValue.getWritable().toString();
  String[] fields=CommonUtils.split(record,modelConfig.getDataSetDelimiter());
  int targetColumnId=CommonUtils.getTargetColumnNum(columnConfigList);
  String tag=StringUtils.trim(fields[targetColumnId]);
  if (this.dataPurifier.isFilterOut(record) && isPosOrNegTag(modelConfig,tag)) {
    double[] inputs=new double[this.inputNodeCount];
    double[] ideal=new double[this.outputNodeCount];
    double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
    if (this.weightColumnId >= 0) {
      try {
        significance=Double.parseDouble(fields[this.weightColumnId]);
      }
 catch (      Exception e) {
      }
    }
    ideal[0]=(this.modelConfig.getPosTags().contains(tag) ? 1.0d : 0.0d);
    int i=0;
    for (    Integer columnId : this.trainingDataSet.getDataColumnIdList()) {
      inputs[i++]=Normalizer.normalize(columnConfigList.get(columnId),fields[columnId]);
    }
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String record=currentValue.getWritable().toString();
  String[] fields=CommonUtils.split(record,modelConfig.getDataSetDelimiter());
  int targetColumnId=CommonUtils.getTargetColumnNum(columnConfigList);
  String tag=StringUtils.trim(fields[targetColumnId]);
  long posRecordCount=0;
  long totalRecordCount=0;
  if (this.dataPurifier.isFilterOut(record) && isPosOrNegTag(modelConfig,tag)) {
    totalRecordCount++;
    if (modelConfig.getPosTags().contains(tag)) {
      posRecordCount++;
    }
    double[] inputs=new double[this.inputNodeCount];
    double[] ideal=new double[this.outputNodeCount];
    double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
    if (this.weightColumnId >= 0) {
      try {
        significance=Double.parseDouble(fields[this.weightColumnId]);
      }
 catch (      Exception e) {
      }
    }
    ideal[0]=(this.modelConfig.getPosTags().contains(tag) ? 1.0d : 0.0d);
    int i=0;
    for (    Integer columnId : this.trainingDataSet.getDataColumnIdList()) {
      inputs[i++]=Normalizer.normalize(columnConfigList.get(columnId),fields[columnId]);
    }
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
  LOG.info("String_Node_Str",totalRecordCount,posRecordCount);
}
Program: 32197
Project: 32197
Buggy source:
public void generateValidateData(Set<Integer> workingColumnIdSet,double validationRate,MLDataSet trainingData,MLDataSet testingData){
  for (  TrainingRecord trainingRecord : trainingRecords) {
    MLDataPair pair=trainingRecord.toMLDataPair(dataColumnIdList,workingColumnIdSet);
    double seed=rd.nextDouble();
    if (seed > validationRate) {
      trainingData.add(pair);
    }
 else {
      testingData.add(pair);
    }
  }
}

Fixed version (ground truth):
public void generateValidateData(Set<Integer> workingColumnIdSet,double validationRate,MLDataSet trainingData,MLDataSet testingData){
  for (  TrainingRecord trainingRecord : trainingRecords) {
    MLDataPair pair=trainingRecord.toMLDataPair(dataColumnIdList,workingColumnIdSet);
    trainingData.add(pair);
  }
}
Program: 32198
Project: 32198
Buggy source:
@Override public void consumeWorkerResults(Iterable<VarSelWorkerResult> workerResults){
  int[] voteStats=new int[columnConfigList.size() + 1];
  for (  VarSelWorkerResult workerResult : workerResults) {
    for (    Integer columnId : workerResult.getColumnIdList()) {
      voteStats[columnId + 1]++;
    }
  }
  int maxVotedColumnId=-1;
  int maxVoteCount=Integer.MIN_VALUE;
  for (int i=0; i < voteStats.length; i++) {
    if (voteStats[i] > maxVoteCount) {
      maxVoteCount=voteStats[i];
      maxVotedColumnId=i;
    }
  }
  if (maxVotedColumnId > 0) {
    workingSet.add(maxVotedColumnId - 1);
  }
}

Fixed version (ground truth):
@Override public void consumeWorkerResults(Iterable<VarSelWorkerResult> workerResults){
  int[] voteStats=new int[columnConfigList.size() + 1];
  for (  VarSelWorkerResult workerResult : workerResults) {
    for (    Integer columnId : workerResult.getColumnIdList()) {
      voteStats[columnId + 1]++;
    }
  }
  int maxVotedColumnId=-1;
  int maxVoteCount=Integer.MIN_VALUE;
  for (int i=0; i < voteStats.length; i++) {
    if (voteStats[i] > maxVoteCount) {
      maxVoteCount=voteStats[i];
      maxVotedColumnId=i;
    }
  }
  LOG.info("String_Node_Str",maxVotedColumnId,maxVoteCount);
  if (maxVotedColumnId > 0) {
    workingSet.add(maxVotedColumnId - 1);
  }
}
Program: 32199
Project: 32199
Buggy source:
public WrapperMasterConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.workingSet=new HashSet<Integer>();
  this.expectVarCount=this.modelConfig.getVarSelectFilterNum();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && columnConfig.isForceSelect()) {
      workingSet.add(columnConfig.getColumnNum());
    }
  }
}

Fixed version (ground truth):
public WrapperMasterConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.workingSet=new HashSet<Integer>();
  this.expectVarCount=this.modelConfig.getVarSelectFilterNum();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && columnConfig.isForceSelect()) {
      workingSet.add(columnConfig.getColumnNum());
    }
  }
  LOG.info("String_Node_Str",expectVarCount,workingSet.size());
}
Program: 32200
Project: 32200
Buggy source:
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  System.out.println("String_Node_Str" + bestCandidate.getColumnName() + "String_Node_Str"+ minValidateError);
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}

Fixed version (ground truth):
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  LOG.info("String_Node_Str" + bestCandidate.getColumnName() + "String_Node_Str"+ minValidateError);
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}
Program: 32202
Project: 32202
Buggy source:
private void votedVariablesSelection() throws ClassNotFoundException, IOException, InterruptedException {
  log.info("String_Node_Str");
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareVarSelParams(args,sourceType);
  Path columnIdsPath=getVotedSelectionPath(sourceType);
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,Constants.VAR_SEL_COLUMN_IDS_OUPUT,columnIdsPath.toString()));
  long start=System.currentTimeMillis();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  guaguaClient.creatJob(args.toArray(new String[0])).waitForCompletion(true);
  log.info("String_Node_Str",System.currentTimeMillis() - start);
  persistColumnIds(columnIdsPath);
  super.syncDataToHdfs(sourceType);
}

Fixed version (ground truth):
private void votedVariablesSelection() throws ClassNotFoundException, IOException, InterruptedException {
  log.info("String_Node_Str");
  super.syncDataToHdfs(modelConfig.getDataSet().getSource());
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareVarSelParams(args,sourceType);
  Path columnIdsPath=getVotedSelectionPath(sourceType);
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,Constants.VAR_SEL_COLUMN_IDS_OUPUT,columnIdsPath.toString()));
  long start=System.currentTimeMillis();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  guaguaClient.creatJob(args.toArray(new String[0])).waitForCompletion(true);
  log.info("String_Node_Str",System.currentTimeMillis() - start);
  persistColumnIds(columnIdsPath);
  super.syncDataToHdfs(sourceType);
}
Program: 32203
Project: 32203
Buggy source:
private Propagation getMLTrain(){
  String alg=(String)modelConfig.getParams().get(PROPAGATION);
  if (!(defaultLearningRate.containsKey(alg))) {
    throw new RuntimeException("String_Node_Str" + alg);
  }
  double rate=defaultLearningRate.get(alg);
  Object rateObj=modelConfig.getParams().get(LEARNING_RATE);
  if (rateObj instanceof Double) {
    rate=(Double)rateObj;
  }
 else   if (rateObj instanceof Integer) {
    rate=((Integer)rateObj).doubleValue();
  }
 else   if (rateObj instanceof Float) {
    rate=((Float)rateObj).doubleValue();
  }
  log.info("String_Node_Str" + learningAlgMap.get(alg));
  if (alg.equals("String_Node_Str") || alg.equals("String_Node_Str") || alg.equals("String_Node_Str")) {
    log.info("String_Node_Str" + rate);
  }
  if (alg.equals("String_Node_Str")) {
    return new Backpropagation(network,trainSet,rate,0);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new QuickPropagation(network,trainSet,rate);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ManhattanPropagation(network,trainSet,rate);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ResilientPropagation(network,trainSet);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ScaledConjugateGradient(network,trainSet);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private Propagation getMLTrain(){
  String alg=(String)modelConfig.getParams().get(PROPAGATION);
  if (!(defaultLearningRate.containsKey(alg))) {
    throw new RuntimeException("String_Node_Str" + alg);
  }
  double rate=defaultLearningRate.get(alg);
  Object rateObj=modelConfig.getParams().get(LEARNING_RATE);
  if (rateObj instanceof Double) {
    rate=(Double)rateObj;
  }
 else   if (rateObj instanceof Integer) {
    rate=((Integer)rateObj).doubleValue();
  }
 else   if (rateObj instanceof Float) {
    rate=((Float)rateObj).doubleValue();
  }
  if (toLoggingProcess)   log.info("String_Node_Str" + learningAlgMap.get(alg));
  if (alg.equals("String_Node_Str") || alg.equals("String_Node_Str") || alg.equals("String_Node_Str")) {
    if (toLoggingProcess)     log.info("String_Node_Str" + rate);
  }
  if (alg.equals("String_Node_Str")) {
    return new Backpropagation(network,trainSet,rate,0);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new QuickPropagation(network,trainSet,rate);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ManhattanPropagation(network,trainSet,rate);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ResilientPropagation(network,trainSet);
  }
 else   if (alg.equals("String_Node_Str")) {
    return new ScaledConjugateGradient(network,trainSet);
  }
 else {
    return null;
  }
}
Program: 32205
Project: 32205
Buggy source:
@Override public double train() throws IOException {
  log.info("String_Node_Str");
  if (this.dryRun) {
    log.info("String_Node_Str" + this.trainerID);
  }
 else {
    log.info("String_Node_Str" + this.trainerID);
  }
  log.info("String_Node_Str" + trainSet.getInputSize());
  log.info("String_Node_Str" + trainSet.getIdealSize());
  buildNetwork();
  Propagation mlTrain=getMLTrain();
  mlTrain.setThreadCount(0);
  if (this.dryRun) {
    return 0.0;
  }
  int epochs=this.modelConfig.getNumTrainEpochs();
  int factor=Math.max(epochs / 50,10);
  setBaseMSE(Double.MAX_VALUE);
  for (int i=0; i < epochs; i++) {
    mlTrain.iteration();
    if (i % factor == 0) {
      this.saveTmpNN(i);
    }
    double validMSE=(this.validSet.getRecordCount() > 0) ? getValidSetError() : mlTrain.getError();
    String extra="String_Node_Str";
    if (validMSE < getBaseMSE()) {
      setBaseMSE(validMSE);
      saveNN();
      extra="String_Node_Str" + this.trainerID + "String_Node_Str";
    }
    log.info("String_Node_Str" + trainerID + "String_Node_Str"+ (i + 1)+ "String_Node_Str"+ df.format(mlTrain.getError())+ "String_Node_Str"+ ((this.validSet.getRecordCount() > 0) ? df.format(validMSE) : "String_Node_Str")+ "String_Node_Str"+ extra);
  }
  mlTrain.finishTraining();
  log.info("String_Node_Str" + this.trainerID + "String_Node_Str");
  return getBaseMSE();
}

Fixed version (ground truth):
@Override public double train() throws IOException {
  if (toLoggingProcess)   log.info("String_Node_Str");
  if (toLoggingProcess) {
    if (this.dryRun) {
      log.info("String_Node_Str" + this.trainerID);
    }
 else {
      log.info("String_Node_Str" + this.trainerID);
    }
    log.info("String_Node_Str" + trainSet.getInputSize());
    log.info("String_Node_Str" + trainSet.getIdealSize());
  }
  buildNetwork();
  Propagation mlTrain=getMLTrain();
  mlTrain.setThreadCount(0);
  if (this.dryRun) {
    return 0.0;
  }
  int epochs=this.modelConfig.getNumTrainEpochs();
  int factor=Math.max(epochs / 50,10);
  setBaseMSE(Double.MAX_VALUE);
  for (int i=0; i < epochs; i++) {
    mlTrain.iteration();
    if (i % factor == 0) {
      this.saveTmpNN(i);
    }
    double validMSE=(this.validSet.getRecordCount() > 0) ? getValidSetError() : mlTrain.getError();
    String extra="String_Node_Str";
    if (validMSE < getBaseMSE()) {
      setBaseMSE(validMSE);
      saveNN();
      extra="String_Node_Str" + this.trainerID + "String_Node_Str";
    }
    if (toLoggingProcess)     log.info("String_Node_Str" + trainerID + "String_Node_Str"+ (i + 1)+ "String_Node_Str"+ df.format(mlTrain.getError())+ "String_Node_Str"+ ((this.validSet.getRecordCount() > 0) ? df.format(validMSE) : "String_Node_Str")+ "String_Node_Str"+ extra);
  }
  mlTrain.finishTraining();
  if (toLoggingProcess)   log.info("String_Node_Str" + this.trainerID + "String_Node_Str");
  return getBaseMSE();
}
Program: 32207
Project: 32207
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  double[] inputs=new double[this.inputNodeCount];
  double[] ideal=new double[this.outputNodeCount];
  double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
  int elementCnt=0;
  for (  String input : Splitter.on(NNConstants.NN_DEFAULT_COLUMN_SEPARATOR).split(currentValue.getWritable().toString())) {
    double dval=NumberFormatUtils.getDouble(input.trim(),0.0d);
    if (elementCnt < this.outputNodeCount) {
      ideal[elementCnt++]=dval;
    }
 else {
      int inputsIndex=(elementCnt++) - this.outputNodeCount;
      if (inputsIndex < this.inputNodeCount) {
        inputs[inputsIndex]=dval;
      }
 else       if (inputsIndex == this.inputNodeCount) {
        significance=dval;
      }
 else {
        break;
      }
    }
  }
  if (elementCnt != this.inputNodeCount + this.outputNodeCount + 1) {
    LOG.warn("String_Node_Str",(this.inputNodeCount + this.outputNodeCount + 1),elementCnt);
  }
 else {
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<VarSelMasterResult,VarSelWorkerResult> workerContext){
  if ((++this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String record=currentValue.getWritable().toString();
  String[] fields=CommonUtils.split(record,modelConfig.getDataSetDelimiter());
  int targetColumnId=CommonUtils.getTargetColumnNum(columnConfigList);
  String tag=StringUtils.trim(fields[targetColumnId]);
  if (this.dataPurifier.isFilterOut(record) && isPosOrNegTag(modelConfig,tag)) {
    double[] inputs=new double[this.inputNodeCount];
    double[] ideal=new double[this.outputNodeCount];
    double significance=NNConstants.DEFAULT_SIGNIFICANCE_VALUE;
    if (this.weightColumnId >= 0) {
      try {
        significance=Double.parseDouble(fields[this.weightColumnId]);
      }
 catch (      Exception e) {
      }
    }
    ideal[0]=(this.modelConfig.getPosTags().contains(tag) ? 1.0d : 0.0d);
    int i=0;
    for (    Integer columnId : this.trainingDataSet.getDataColumnIdList()) {
      inputs[i++]=Normalizer.normalize(columnConfigList.get(columnId),fields[columnId]);
    }
    trainingDataSet.addTrainingRecord(new TrainingRecord(inputs,ideal,significance));
  }
}
Program: 32208
Project: 32208
Buggy source:
private List<Integer> getNormalizedColumnIdList(){
  List<Integer> normalizedColumnIdList=new ArrayList<Integer>();
  for (  ColumnConfig config : columnConfigList) {
    if (config.isCandidate()) {
      normalizedColumnIdList.add(config.getColumnNum());
    }
  }
  return normalizedColumnIdList;
}

Fixed version (ground truth):
private List<Integer> getNormalizedColumnIdList(){
  List<Integer> normalizedColumnIdList=new ArrayList<Integer>();
  for (  ColumnConfig config : columnConfigList) {
    if (config.isCandidate() && isGoodVarSelCandidate(config)) {
      normalizedColumnIdList.add(config.getColumnNum());
    }
  }
  return normalizedColumnIdList;
}
Program: 32209
Project: 32209
Buggy source:
public MLDataPair toMLDataPair(List<Integer> dataColumnIdList,Set<Integer> workingColumnSet){
  return null;
}

Fixed version (ground truth):
public MLDataPair toMLDataPair(List<Integer> dataColumnIdList,Set<Integer> workingColumnSet){
  double[] params=new double[workingColumnSet.size()];
  int pos=0;
  for (int i=0; i < dataColumnIdList.size(); i++) {
    if (workingColumnSet.contains(dataColumnIdList.get(i))) {
      params[pos++]=inputs[i];
    }
  }
  return new BasicMLDataPair(new BasicMLData(params),new BasicMLData(this.ideal));
}
Program: 32210
Project: 32210
Buggy source:
public double runValidate(){
  MLDataSet trainingData=new BasicMLDataSet();
  MLDataSet testingData=new BasicMLDataSet();
  this.trainingDataSet.generateValidateData(this.workingColumnSet,this.modelConfig.getCrossValidationRate(),trainingData,testingData);
  NNTrainer trainer=new NNTrainer(this.modelConfig,1,false);
  trainer.setTrainSet(trainingData);
  trainer.setValidSet(testingData);
  trainer.disableModelPersistence();
  double validateError=Double.MAX_VALUE;
  try {
    validateError=trainer.train();
  }
 catch (  IOException e) {
    validateError=trainer.getBaseMSE();
  }
  return validateError;
}

Fixed version (ground truth):
public double runValidate(){
  MLDataSet trainingData=new BasicMLDataSet();
  MLDataSet testingData=new BasicMLDataSet();
  this.trainingDataSet.generateValidateData(this.workingColumnSet,this.modelConfig.getCrossValidationRate(),trainingData,testingData);
  NNTrainer trainer=new NNTrainer(this.modelConfig,1,false);
  trainer.setTrainSet(trainingData);
  trainer.setValidSet(testingData);
  trainer.disableModelPersistence();
  trainer.disableLogging();
  double validateError=Double.MAX_VALUE;
  try {
    validateError=trainer.train();
  }
 catch (  IOException e) {
    validateError=trainer.getBaseMSE();
  }
  return validateError;
}
Program: 32211
Project: 32211
Buggy source:
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}

Fixed version (ground truth):
@Override public VarSelWorkerResult generateVarSelResult(){
  Set<Integer> workingColumnSet=new HashSet<Integer>();
  double minValidateError=Double.MAX_VALUE;
  ColumnConfig bestCandidate=null;
  for (  ColumnConfig columnConfig : candidates) {
    if (!baseColumnSet.contains(columnConfig.getColumnNum())) {
      workingColumnSet.clear();
      workingColumnSet.addAll(baseColumnSet);
      workingColumnSet.add(columnConfig.getColumnNum());
      ValidationConductor validationConductor=new ValidationConductor(modelConfig,columnConfigList,workingColumnSet,trainingDataSet);
      double validateError=validationConductor.runValidate();
      if (validateError < minValidateError) {
        minValidateError=validateError;
        bestCandidate=columnConfig;
      }
    }
  }
  System.out.println("String_Node_Str" + bestCandidate.getColumnName() + "String_Node_Str"+ minValidateError);
  return ((bestCandidate == null) ? getDefaultWorkerResult() : getWorkerResult(bestCandidate.getColumnNum()));
}
Program: 32212
Project: 32212
Buggy source:
public WrapperWorkerConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.candidates=new ArrayList<ColumnConfig>();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && !columnConfig.isFinalSelect()) {
      candidates.add(columnConfig);
    }
  }
}

Fixed version (ground truth):
public WrapperWorkerConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.candidates=new ArrayList<ColumnConfig>();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && !columnConfig.isForceSelect()) {
      candidates.add(columnConfig);
    }
  }
}
Program: 32215
Project: 32215
Buggy source:
public void addData(double data,int frequency){
  if (frequency <= 0) {
    log.warn("String_Node_Str" + frequency);
    return;
  }
  if (Double.isInfinite(data) || Double.isNaN(data) || Math.abs(data) > threshold) {
    log.warn("String_Node_Str" + data);
    return;
  }
  validElementCnt+=frequency;
  max=Math.max(max,data);
  min=Math.min(min,data);
  sum+=data * frequency;
  squaredSum+=data * data * frequency;
}

Fixed version (ground truth):
public void addData(double data,int frequency){
  if (frequency <= 0) {
    log.warn("String_Node_Str" + frequency);
    return;
  }
  if (Double.isInfinite(data) || Double.isNaN(data) || Math.abs(data) > threshold) {
    log.warn("String_Node_Str" + data);
    return;
  }
  validElementCnt+=frequency;
  max=Math.max(max,data);
  min=Math.min(min,data);
  sum+=data * frequency;
  squaredSum+=data * data * frequency;
  for (int i=0; i < frequency; i++) {
    estimator.add(data);
  }
}
Program: 32216
Project: 32216
Buggy source:
/** 
 * add negative infinity and positive infinity, merge same bins
 * @param bins
 * @return
 */
private List<Double> binMerge(List<Double> bins){
  List<Double> newBins=new ArrayList<Double>();
  if (bins.size() == 0) {
    bins.add(Double.NaN);
    return bins;
  }
  newBins.add(Double.NEGATIVE_INFINITY);
  Double cur=bins.get(0);
  newBins.add(cur);
  int i=1;
  while (i < bins.size()) {
    if (Math.abs(cur - bins.get(i)) > 1e-4) {
      newBins.add(bins.get(i));
    }
    cur=bins.get(i);
    i++;
  }
  newBins.add(Double.POSITIVE_INFINITY);
  return newBins;
}

Fixed version (ground truth):
/** 
 * set min/max, merge same bins
 * @param bins
 * @return
 */
private List<Double> binMerge(List<Double> bins){
  List<Double> newBins=new ArrayList<Double>();
  if (bins.size() == 0) {
    bins.add(Double.NaN);
    return bins;
  }
  Double cur=bins.get(0);
  newBins.add(cur);
  int i=1;
  while (i < bins.size()) {
    if (Math.abs(cur - bins.get(i)) > 1e-4) {
      newBins.add(bins.get(i));
    }
    cur=bins.get(i);
    i++;
  }
  if (newBins.size() == 1) {
    double val=newBins.get(0);
    newBins=Arrays.asList(new Double[]{Double.NEGATIVE_INFINITY,val});
  }
 else   if (newBins.size() == 2) {
    newBins.set(0,Double.NEGATIVE_INFINITY);
  }
 else {
    newBins.set(0,Double.NEGATIVE_INFINITY);
    newBins.remove(newBins.size() - 1);
  }
  return newBins;
}
Program: 32217
Project: 32217
Buggy source:
@Override public void addData(String val){
  String fval=StringUtils.trimToEmpty(val);
  Double dval=Double.valueOf(0.0);
  try {
    dval=Double.parseDouble(fval);
    estimator.add(dval);
  }
 catch (  NumberFormatException e) {
    super.incInvalidValCnt();
  }
}

Fixed version (ground truth):
@Override public void addData(String val){
  String fval=StringUtils.trimToEmpty(val);
  try {
    Double dval=Double.valueOf(0.0);
    dval=Double.parseDouble(fval);
    estimator.add(dval);
  }
 catch (  NumberFormatException e) {
    super.incInvalidValCnt();
  }
}
Program: 32218
Project: 32218
Buggy source:
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() != 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=super.columnConfigList.get(columnId);
  AbstractBinning<?> binning=null;
  if (columnConfig.isCategorical()) {
    binning=new CategoricalBinning(-1);
  }
 else {
    if (super.modelConfig.getBinningMethod().equals(BinningMethod.EqualInterval)) {
      binning=new EqualIntervalBinning(modelConfig.getStats().getMaxNumBin());
    }
 else {
      binning=new MunroPatBinning(modelConfig.getStats().getMaxNumBin());
    }
  }
  Iterator<Tuple> iterator=databag.iterator();
  while (iterator.hasNext()) {
    Tuple element=iterator.next();
    if (element == null || element.size() != 4) {
      continue;
    }
    Object value=element.get(1);
    if (value != null) {
      binning.addData(value.toString());
    }
  }
  Tuple output=TupleFactory.getInstance().newTuple(2);
  output.set(0,columnId);
  output.set(1,StringUtils.join(binning.getDataBin(),CalculateStatsUDF.CATEGORY_VAL_SEPARATOR));
  return output;
}

Fixed version (ground truth):
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() != 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=super.columnConfigList.get(columnId);
  AbstractBinning<?> binning=null;
  if (columnConfig.isCategorical()) {
    binning=new CategoricalBinning(-1);
  }
 else {
    if (super.modelConfig.getBinningMethod().equals(BinningMethod.EqualInterval)) {
      binning=new EqualIntervalBinning(modelConfig.getStats().getMaxNumBin());
    }
 else {
switch (this.modelConfig.getBinningAlgorithm()) {
case Native:
        log.info("String_Node_Str");
      binning=new NativeBinning(modelConfig.getStats().getMaxNumBin(),true);
    break;
case SPDT:
  log.info("String_Node_Str");
binning=new EqualPopulationBinning(modelConfig.getStats().getMaxNumBin());
break;
case MunroPat:
log.info("String_Node_Str");
binning=new MunroPatBinning(modelConfig.getStats().getMaxNumBin());
break;
}
}
}
Iterator<Tuple> iterator=databag.iterator();
while (iterator.hasNext()) {
Tuple element=iterator.next();
if (element == null || element.size() != 4) {
continue;
}
Object value=element.get(1);
if (value != null) {
binning.addData(value.toString());
}
}
Tuple output=TupleFactory.getInstance().newTuple(2);
output.set(0,columnId);
output.set(1,StringUtils.join(binning.getDataBin(),CalculateStatsUDF.CATEGORY_VAL_SEPARATOR));
return output;
}
Program: 32219
Project: 32219
Buggy source:
/** 
 * Return the real bin number for one value. As the first bin value is NEGATIVE_INFINITY, invalid index is 0, not -1.
 * @param binBoundary bin boundary list which should be sorted.
 * @throws IllegalArgumentException if binBoundary is null or empty.
 */
private static int getNumericBinNum(List<Double> binBoundary,double value){
  if (CollectionUtils.isEmpty(binBoundary)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int n=binBoundary.size() - 1;
  while (n > 0 && value <= binBoundary.get(n)) {
    n--;
  }
  return n;
}

Fixed version (ground truth):
/** 
 * Return the real bin number for one value. As the first bin value is NEGATIVE_INFINITY, invalid index is 0, not -1.
 * @param binBoundary bin boundary list which should be sorted.
 * @throws IllegalArgumentException if binBoundary is null or empty.
 */
private static int getNumericBinNum(List<Double> binBoundary,double value){
  if (CollectionUtils.isEmpty(binBoundary)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int n=binBoundary.size() - 1;
  while (n > 0 && value < binBoundary.get(n)) {
    n--;
  }
  return n;
}
Program: 32220
Project: 32220
Buggy source:
public WrapperWorkerConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.candidates=new ArrayList<ColumnConfig>();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && !columnConfig.isForceSelect()) {
      candidates.add(columnConfig);
    }
  }
}

Fixed version (ground truth):
public WrapperWorkerConductor(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){
  super(modelConfig,columnConfigList);
  this.candidates=new ArrayList<ColumnConfig>();
  for (  ColumnConfig columnConfig : columnConfigList) {
    if (columnConfig.isCandidate() && !columnConfig.isForceSelect()) {
      candidates.add(columnConfig);
    }
  }
  LOG.info("String_Node_Str",candidates.size());
}
Program: 32222
Project: 32222
Buggy source:
private void votedVariablesSelection() throws ClassNotFoundException, IOException, InterruptedException {
  log.info("String_Node_Str");
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareVarSelParams(args,sourceType);
  Path columnIdsPath=getVotedSelectionPath(sourceType);
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,Constants.VAR_SEL_COLUMN_IDS_OUPUT,columnIdsPath.toString()));
  System.out.println(args);
  long start=System.currentTimeMillis();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  guaguaClient.creatJob(args.toArray(new String[0])).waitForCompletion(true);
  log.info("String_Node_Str",System.currentTimeMillis() - start);
  persistColumnIds(columnIdsPath);
}

Fixed version (ground truth):
private void votedVariablesSelection() throws ClassNotFoundException, IOException, InterruptedException {
  log.info("String_Node_Str");
  SourceType sourceType=super.getModelConfig().getDataSet().getSource();
  final List<String> args=new ArrayList<String>();
  prepareVarSelParams(args,sourceType);
  Path columnIdsPath=getVotedSelectionPath(sourceType);
  args.add(String.format(NNConstants.MAPREDUCE_PARAM_FORMAT,Constants.VAR_SEL_COLUMN_IDS_OUPUT,columnIdsPath.toString()));
  long start=System.currentTimeMillis();
  GuaguaMapReduceClient guaguaClient=new GuaguaMapReduceClient();
  guaguaClient.creatJob(args.toArray(new String[0])).waitForCompletion(true);
  log.info("String_Node_Str",System.currentTimeMillis() - start);
  persistColumnIds(columnIdsPath);
  super.syncDataToHdfs(sourceType);
}
Program: 32225
Project: 32225
Buggy source:
public void addData(double data){
  if (Double.isInfinite(data) || Double.isNaN(data) || Math.abs(data) > threshold) {
    log.warn("String_Node_Str" + data);
    return;
  }
  validElementCnt++;
  max=Math.max(max,data);
  min=Math.min(min,data);
  sum+=data;
  squaredSum+=data * data;
}

Fixed version (ground truth):
public void addData(double data,int frequency){
  if (frequency <= 0) {
    log.warn("String_Node_Str" + frequency);
    return;
  }
  if (Double.isInfinite(data) || Double.isNaN(data) || Math.abs(data) > threshold) {
    log.warn("String_Node_Str" + data);
    return;
  }
  validElementCnt+=frequency;
  max=Math.max(max,data);
  min=Math.min(min,data);
  sum+=data * frequency;
  squaredSum+=data * data * frequency;
}
Program: 32226
Project: 32226
Buggy source:
/** 
 * @param dval
 */
private void process(double dval){
  HistogramUnit hu=getHistogramUnitIndex(dval);
  if (hu != null) {
    hu.setHcnt(hu.getHcnt() + 1);
  }
 else {
    hu=new HistogramUnit(dval,1);
    histogram.add(hu);
    Collections.sort(histogram);
    if (histogram.size() > this.maxHistogramUnitCnt) {
      mergeHistogram();
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dval
 */
private void process(double dval,int frequency){
  HistogramUnit hu=getHistogramUnitIndex(dval);
  if (hu != null) {
    hu.setHcnt(hu.getHcnt() + frequency);
  }
 else {
    hu=new HistogramUnit(dval,frequency);
    histogram.add(hu);
    Collections.sort(histogram);
    if (histogram.size() > this.maxHistogramUnitCnt) {
      mergeHistogram();
    }
  }
}
Program: 32227
Project: 32227
Buggy source:
/** 
 * @param s
 * @return
 */
private int locateHistogram(double s){
  for (int i=0; i < histogram.size() - 1; i++) {
    HistogramUnit chu=histogram.get(i);
    HistogramUnit nhu=histogram.get(i + 1);
    double sc=sum(chu.getHval());
    double sn=sum(nhu.getHval());
    if (sc < s && s <= sn) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * @param s
 * @return
 */
private int locateHistogram(double s,int startPos){
  for (int i=startPos; i < histogram.size() - 1; i++) {
    HistogramUnit chu=histogram.get(i);
    HistogramUnit nhu=histogram.get(i + 1);
    double sc=sum(chu.getHval());
    double sn=sum(nhu.getHval());
    if (sc < s && s <= sn) {
      return i;
    }
  }
  return -1;
}
Program: 32228
Project: 32228
Buggy source:
public void addData(double val){
  process(val);
}

Fixed version (ground truth):
public void addData(double val,int frequency){
  process(val,frequency);
}