nus-yam/ex-repair huggingface dataset:
Program: 31747
Project: 31747
Buggy source:
private void recoverGBTData(WorkerContext<DTMasterParams,DTWorkerParams> context,float output,float predict,Data data,boolean isFailoverOrContinuous){
  final List<TreeNode> trees=this.recoverTrees;
  if (trees == null) {
    return;
  }
  if (trees.size() >= 1) {
    int iterLen=isFailoverOrContinuous ? trees.size() - 1 : trees.size();
    for (int i=0; i < iterLen; i++) {
      TreeNode currTree=trees.get(i);
      if (i == 0) {
        double oldPredict=predictNodeIndex(currTree.getNode(),data,false).getPredict().getPredict();
        predict=(float)oldPredict;
        output=-1f * loss.computeGradient(predict,data.label);
      }
 else {
        if (this.dropOutRate > 0.0 && rand.nextDouble() < this.dropOutRate) {
          continue;
        }
        double oldPredict=predictNodeIndex(currTree.getNode(),data,false).getPredict().getPredict();
        predict+=(float)(this.learningRate * oldPredict);
        output=-1f * loss.computeGradient(predict,data.label);
      }
    }
    data.output=output;
    data.predict=predict;
  }
}

Fixed version (ground truth):
private void recoverGBTData(WorkerContext<DTMasterParams,DTWorkerParams> context,float output,float predict,Data data,boolean isFailoverOrContinuous){
  final List<TreeNode> trees=this.recoverTrees;
  if (trees == null) {
    return;
  }
  if (trees.size() >= 1) {
    int iterLen=isFailoverOrContinuous ? trees.size() - 1 : trees.size();
    for (int i=0; i < iterLen; i++) {
      TreeNode currTree=trees.get(i);
      if (i == 0) {
        double oldPredict=predictNodeIndex(currTree.getNode(),data,false).getPredict().getPredict();
        predict=(float)oldPredict;
        output=-1f * loss.computeGradient(predict,data.label);
      }
 else {
        if (this.dropOutRate > 0.0 && dropOutRandom.nextDouble() < this.dropOutRate) {
          continue;
        }
        double oldPredict=predictNodeIndex(currTree.getNode(),data,false).getPredict().getPredict();
        predict+=(float)(this.learningRate * oldPredict);
        output=-1f * loss.computeGradient(predict,data.label);
      }
    }
    data.output=output;
    data.predict=predict;
  }
}
Program: 31748
Project: 31748
Buggy source:
public Boolean getTrainOnDisk(){
  return trainOnDisk;
}

Fixed version (ground truth):
@JsonIgnore public Boolean getTrainOnDisk(){
  return trainOnDisk;
}
Program: 31750
Project: 31750
Buggy source:
public double[] calculateWeights(double[] weights,double[] gradients){
  for (int i=0; i < gradients.length; i++) {
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.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: 31751
Project: 31751
Buggy source:
private double updateWeightSCG(int index,double[] weights,double[] gradients){
  return 0;
}

Fixed version (ground truth):
private double updateWeightSCG(int index,double[] weights,double[] gradients){
  throw new RuntimeException("String_Node_Str");
}
Program: 31752
Project: 31752
Buggy source:
public Weight(int numWeight,double numTrainSize,double rate,String algorithm,double reg,RegulationLevel rl){
  this.lastDelta=new double[numWeight];
  this.lastGradient=new double[numWeight];
  this.numTrainSize=numTrainSize;
  this.eps=this.outputEpsilon / numTrainSize;
  this.shrink=rate / (1.0 + rate);
  this.learningRate=rate;
  this.algorithm=algorithm;
  this.updateValues=new double[numWeight];
  for (int i=0; i < this.updateValues.length; i++) {
    this.updateValues[i]=DEFAULT_INITIAL_UPDATE;
    this.lastDelta[i]=0;
  }
  this.reg=reg;
  if (rl != null) {
    this.rl=rl;
  }
}

Fixed version (ground truth):
public Weight(int numWeight,double numTrainSize,double rate,String algorithm,double reg,RegulationLevel rl,double dropoutRate){
  this.dropoutRate=dropoutRate;
  this.random=new Random();
  this.lastDelta=new double[numWeight];
  this.lastGradient=new double[numWeight];
  this.numTrainSize=numTrainSize;
  this.eps=this.outputEpsilon / numTrainSize;
  this.shrink=rate / (1.0 + rate);
  this.learningRate=rate;
  this.algorithm=algorithm;
  this.updateValues=new double[numWeight];
  for (int i=0; i < this.updateValues.length; i++) {
    this.updateValues[i]=DEFAULT_INITIAL_UPDATE;
    this.lastDelta[i]=0;
  }
  this.reg=reg;
  if (rl != null) {
    this.rl=rl;
  }
}
Program: 31758
Project: 31758
Buggy source:
public boolean nextKeyValue() throws IOException {
  if (key == null) {
    key=new LongWritable();
  }
  key.set(pos);
  if (value == null) {
    value=new Text();
  }
  int newSize=0;
  while (pos < end) {
    newSize=in.readLine(value,maxLineLength,Math.max((int)Math.min(Integer.MAX_VALUE,end - pos),maxLineLength));
    if (newSize == 0) {
      break;
    }
    pos+=newSize;
    if (newSize < maxLineLength) {
      break;
    }
    LOG.info("String_Node_Str" + newSize + "String_Node_Str"+ (pos - newSize));
  }
  if (this.splitIndex == this.fileSplits.length && newSize == 0 && consumedSplitSize == wholeSize) {
    key=null;
    value=null;
    return false;
  }
  if (newSize == 0) {
    if (this.splitIndex < this.fileSplits.length) {
      consumedSplitSize+=(end - start);
      close();
      FileSplit currSplit=this.fileSplits[this.splitIndex++];
      initializeOne(context,currSplit);
      if (currSplit.getLength() == 0L) {
        throw new IllegalStateException("String_Node_Str" + currSplit + "String_Node_Str");
      }
      return nextKeyValue();
    }
 else {
      consumedSplitSize+=(end - start);
      key=null;
      value=null;
      return false;
    }
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
public boolean nextKeyValue() throws IOException {
  if (key == null) {
    key=new LongWritable();
  }
  key.set(pos);
  if (value == null) {
    value=new Text();
  }
  int newSize=0;
  while (getFilePosition() <= end || in.needAdditionalRecordAfterSplit()) {
    if (pos == 0) {
      newSize=skipUtfByteOrderMark();
    }
 else {
      newSize=in.readLine(value,maxLineLength,maxBytesToConsume(pos));
      pos+=newSize;
    }
    if ((newSize == 0) || (newSize < maxLineLength)) {
      break;
    }
    LOG.info("String_Node_Str" + newSize + "String_Node_Str"+ (pos - newSize));
  }
  if (this.splitIndex == this.fileSplits.length && newSize == 0 && consumedSplitSize == wholeSize) {
    key=null;
    value=null;
    return false;
  }
  if (newSize == 0) {
    if (this.splitIndex < this.fileSplits.length) {
      consumedSplitSize+=(end - start);
      close();
      FileSplit currSplit=this.fileSplits[this.splitIndex++];
      initializeOne(currSplit,context);
      if (currSplit.getLength() == 0L) {
        throw new IllegalStateException("String_Node_Str" + currSplit + "String_Node_Str");
      }
      return nextKeyValue();
    }
 else {
      consumedSplitSize+=(end - start);
      key=null;
      value=null;
      return false;
    }
  }
 else {
    return true;
  }
}
Program: 31759
Project: 31759
Buggy source:
private void initializeOne(TaskAttemptContext context,FileSplit split) throws IOException {
  Configuration job=context.getConfiguration();
  this.maxLineLength=job.getInt("String_Node_Str",Integer.MAX_VALUE);
  start=split.getStart();
  end=start + split.getLength();
  final Path file=split.getPath();
  compressionCodecs=new CompressionCodecFactory(job);
  final CompressionCodec codec=compressionCodecs.getCodec(file);
  FileSystem fs=file.getFileSystem(job);
  FSDataInputStream fileIn=fs.open(split.getPath());
  boolean skipFirstLine=false;
  if (codec != null) {
    if (null == this.recordDelimiterBytes) {
      in=new LineReader(codec.createInputStream(fileIn),job);
    }
 else {
      in=new LineReader(codec.createInputStream(fileIn),job,this.recordDelimiterBytes);
    }
    end=Long.MAX_VALUE;
  }
 else {
    if (start != 0) {
      skipFirstLine=true;
      --start;
      fileIn.seek(start);
    }
    if (null == this.recordDelimiterBytes) {
      in=new LineReader(fileIn,job);
    }
 else {
      in=new LineReader(fileIn,job,this.recordDelimiterBytes);
    }
  }
  if (skipFirstLine) {
    start+=in.readLine(new Text(),0,(int)Math.min((long)Integer.MAX_VALUE,end - start));
  }
  this.pos=start;
}

Fixed version (ground truth):
public void initializeOne(FileSplit split,TaskAttemptContext context) throws IOException {
  Configuration job=context.getConfiguration();
  this.maxLineLength=job.getInt(MAX_LINE_LENGTH,Integer.MAX_VALUE);
  start=split.getStart();
  end=start + split.getLength();
  final Path file=split.getPath();
  final FileSystem fs=file.getFileSystem(job);
  fileIn=fs.open(file);
  CompressionCodec codec=new CompressionCodecFactory(job).getCodec(file);
  if (null != codec) {
    isCompressedInput=true;
    decompressor=CodecPool.getDecompressor(codec);
    if (codec instanceof SplittableCompressionCodec) {
      final SplitCompressionInputStream cIn=((SplittableCompressionCodec)codec).createInputStream(fileIn,decompressor,start,end,SplittableCompressionCodec.READ_MODE.BYBLOCK);
      in=new CompressedSplitLineReader(cIn,job,this.recordDelimiterBytes);
      start=cIn.getAdjustedStart();
      end=cIn.getAdjustedEnd();
      filePosition=cIn;
    }
 else {
      in=new SplitLineReader(codec.createInputStream(fileIn,decompressor),job,this.recordDelimiterBytes);
      filePosition=fileIn;
    }
  }
 else {
    fileIn.seek(start);
    in=new SplitLineReader(fileIn,job,this.recordDelimiterBytes);
    filePosition=fileIn;
  }
  if (start != 0) {
    start+=in.readLine(new Text(),0,maxBytesToConsume(start));
  }
  this.pos=start;
}
Program: 31760
Project: 31760
Buggy source:
public void initialize(InputSplit genericSplit,TaskAttemptContext context) throws IOException {
  this.splitIndex=0;
  this.context=context;
  this.fileSplits=((CombineInputSplit)genericSplit).getFileSplits();
  initializeOne(context,this.fileSplits[this.splitIndex++]);
  for (  FileSplit fileSplit : this.fileSplits) {
    this.wholeSize+=fileSplit.getLength();
  }
}

Fixed version (ground truth):
public void initialize(InputSplit genericSplit,TaskAttemptContext context) throws IOException {
  this.splitIndex=0;
  this.context=context;
  this.fileSplits=((CombineInputSplit)genericSplit).getFileSplits();
  initializeOne(this.fileSplits[this.splitIndex++],context);
  for (  FileSplit fileSplit : this.fileSplits) {
    this.wholeSize+=fileSplit.getLength();
  }
}
Program: 31761
Project: 31761
Buggy source:
/** 
 * Get the progress within the split
 */
public float getProgress(){
  if (start == end) {
    return 0.0f;
  }
 else {
    return Math.min(1.0f,((consumedSplitSize + (pos - start)) * 1f) / (this.wholeSize * 1f));
  }
}

Fixed version (ground truth):
/** 
 * Get the progress within the split
 */
public float getProgress() throws IOException {
  if (start == end) {
    return 0.0f;
  }
 else {
    return Math.min(1.0f,((consumedSplitSize + (getFilePosition() - start)) * 1f) / (this.wholeSize * 1f));
  }
}
Program: 31762
Project: 31762
Buggy source:
public synchronized void close() throws IOException {
  if (in != null) {
    in.close();
  }
}

Fixed version (ground truth):
public synchronized void close() throws IOException {
  try {
    if (in != null) {
      in.close();
    }
  }
  finally {
    if (decompressor != null) {
      CodecPool.returnDecompressor(decompressor);
    }
  }
}
Program: 31763
Project: 31763
Buggy source:
private boolean inputOutputModelCheckSuccess(FileSystem fileSystem,Path modelPath) throws IOException {
  MLInputOutput model=(MLInputOutput)CommonUtils.loadModel(this.modelConfig,modelPath,fileSystem);
  int[] outputCandidateCounts=DTrainUtils.getInputOutputCandidateCounts(getColumnConfigList());
  return model.getInputCount() == outputCandidateCounts[0] && model.getOutputCount() == outputCandidateCounts[1];
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private boolean inputOutputModelCheckSuccess(FileSystem fileSystem,Path modelPath,Map<String,Object> modelParams) throws IOException {
  BasicNetwork model=(BasicNetwork)CommonUtils.loadModel(this.modelConfig,modelPath,fileSystem);
  int[] outputCandidateCounts=DTrainUtils.getInputOutputCandidateCounts(getColumnConfigList());
  int inputs=outputCandidateCounts[0] == 0 ? outputCandidateCounts[2] : outputCandidateCounts[0];
  boolean isInputOutConsistent=model.getInputCount() == inputs && model.getOutputCount() == outputCandidateCounts[1];
  if (!isInputOutConsistent) {
    return false;
  }
  boolean isHasSameHidderLayer=(model.getLayerCount() - 2) == (Integer)modelParams.get(NNTrainer.NUM_HIDDEN_LAYERS);
  if (!isHasSameHidderLayer) {
    return false;
  }
  boolean isHasSameHiddenNodes=true;
  List<Integer> hiddenNodeList=(List<Integer>)modelParams.get(NNTrainer.NUM_HIDDEN_NODES);
  for (int i=0; i < hiddenNodeList.size(); i++) {
    if (model.getLayerNeuronCount(i + 1) != hiddenNodeList.get(i)) {
      isHasSameHiddenNodes=false;
      break;
    }
  }
  if (!isHasSameHiddenNodes) {
    return false;
  }
  boolean isHasSameHiddenActiviation=true;
  List<String> actFunc=(List<String>)modelParams.get(NNTrainer.ACTIVATION_FUNC);
  for (int i=0; i < actFunc.size(); i++) {
    ActivationFunction activation=model.getActivation(i + 1);
    if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_LINEAR)) {
      isHasSameHiddenActiviation=ActivationLinear.class == activation.getClass();
    }
 else     if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_SIGMOID)) {
      isHasSameHiddenActiviation=ActivationSigmoid.class == activation.getClass();
    }
 else     if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_TANH)) {
      isHasSameHiddenActiviation=ActivationTANH.class == activation.getClass();
    }
 else     if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_LOG)) {
      isHasSameHiddenActiviation=ActivationLOG.class == activation.getClass();
    }
 else     if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_SIN)) {
      isHasSameHiddenActiviation=ActivationSIN.class == activation.getClass();
    }
 else     if (actFunc.get(i).equalsIgnoreCase(NNConstants.NN_RELU)) {
      isHasSameHiddenActiviation=ActivationReLU.class == activation.getClass();
    }
 else {
      isHasSameHiddenActiviation=ActivationSigmoid.class == activation.getClass();
    }
    if (!isHasSameHiddenActiviation) {
      break;
    }
  }
  if (!isHasSameHiddenActiviation) {
    return false;
  }
  return true;
}
Program: 31766
Project: 31766
Buggy source:
public static void loadShifuConfig() throws IOException {
  loadProperties(properties,getProperty(Environment.SHIFU_HOME) + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str");
  loadProperties(properties,File.separator + "String_Node_Str" + File.separator+ "String_Node_Str");
  String userHome=System.getProperty("String_Node_Str");
  loadProperties(properties,userHome + File.separator + "String_Node_Str");
}

Fixed version (ground truth):
public static void loadShifuConfig() throws IOException {
  loadProperties(properties,getProperty(Environment.SHIFU_HOME) + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str");
  loadProperties(properties,getProperty(Environment.SHIFU_HOME) + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str");
  loadProperties(properties,getProperty(Environment.SHIFU_HOME) + File.separator + "String_Node_Str");
  loadProperties(properties,File.separator + "String_Node_Str" + File.separator+ "String_Node_Str");
  String userHome=System.getProperty("String_Node_Str");
  loadProperties(properties,userHome + File.separator + "String_Node_Str");
}
Program: 31768
Project: 31768
Buggy source:
private int parseThreadNum(){
  int threads=4;
  try {
    threads=Integer.parseInt(Environment.getProperty(Constants.SHIFU_CORRELATION_MULTI_THREADS,threads + "String_Node_Str"));
  }
 catch (  Exception e) {
    log.warn("String_Node_Str",threads);
  }
  if (threads <= 0) {
    threads=4;
  }
  return threads;
}

Fixed version (ground truth):
private int parseThreadNum(){
  int threads=6;
  try {
    threads=Integer.parseInt(Environment.getProperty(Constants.SHIFU_CORRELATION_MULTI_THREADS,threads + "String_Node_Str"));
  }
 catch (  Exception e) {
    log.warn("String_Node_Str",threads);
  }
  if (threads <= 0) {
    threads=6;
  }
  return threads;
}
Program: 31770
Project: 31770
Buggy source:
public RunModelWorker(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,EvalConfig evalConfig,ActorRef parentActorRef,ActorRef nextActorRef) throws IOException {
  super(modelConfig,columnConfigList,parentActorRef,nextActorRef);
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,evalConfig,SourceType.LOCAL);
  String[] header=null;
  String delimiter=null;
  if (null == evalConfig || null == evalConfig.getDataSet().getHeaderPath() || null == evalConfig.getDataSet().getHeaderDelimiter()) {
    header=CommonUtils.getFinalHeaders(modelConfig);
    delimiter=modelConfig.getDataSetDelimiter();
  }
 else {
    header=CommonUtils.getFinalHeaders(evalConfig);
    delimiter=evalConfig.getDataSet().getDataDelimiter();
  }
  modelRunner=new ModelRunner(modelConfig,columnConfigList,header,delimiter,models);
  List<ModelSpec> subModels=CommonUtils.loadSubModels(modelConfig,this.columnConfigList,evalConfig,evalConfig.getDataSet().getSource(),evalConfig.getGbtConvertToProb());
  if (CollectionUtils.isNotEmpty(subModels)) {
    for (    ModelSpec modelSpec : subModels) {
      this.modelRunner.addSubModels(modelSpec);
    }
  }
}

Fixed version (ground truth):
public RunModelWorker(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,EvalConfig evalConfig,ActorRef parentActorRef,ActorRef nextActorRef) throws IOException {
  super(modelConfig,columnConfigList,parentActorRef,nextActorRef);
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,evalConfig,SourceType.LOCAL);
  String[] header=null;
  String delimiter=null;
  if (null == evalConfig || null == evalConfig.getDataSet().getHeaderPath() || null == evalConfig.getDataSet().getHeaderDelimiter()) {
    header=CommonUtils.getFinalHeaders(modelConfig);
    delimiter=modelConfig.getDataSetDelimiter();
  }
 else {
    header=CommonUtils.getFinalHeaders(evalConfig);
    delimiter=evalConfig.getDataSet().getDataDelimiter();
  }
  modelRunner=new ModelRunner(modelConfig,columnConfigList,header,delimiter,models);
  boolean gbtConvertToProp=((evalConfig == null) ? false : evalConfig.getGbtConvertToProb());
  SourceType sourceType=((evalConfig == null) ? modelConfig.getDataSet().getSource() : evalConfig.getDataSet().getSource());
  List<ModelSpec> subModels=CommonUtils.loadSubModels(modelConfig,this.columnConfigList,evalConfig,sourceType,gbtConvertToProp);
  if (CollectionUtils.isNotEmpty(subModels)) {
    for (    ModelSpec modelSpec : subModels) {
      this.modelRunner.addSubModels(modelSpec);
    }
  }
}
Program: 31771
Project: 31771
Buggy source:
public ConfusionMatrix(ModelConfig modelConfig,EvalConfig evalConfig) throws IOException {
  this.modelConfig=modelConfig;
  this.evalConfig=evalConfig;
  String[] evalScoreHeader=getEvalScoreHeader();
  if (ArrayUtils.isEmpty(evalScoreHeader)) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_NO_EVALSCORE_HEADER);
  }
  if (StringUtils.isEmpty(evalConfig.getPerformanceScoreSelector())) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
  }
  if (modelConfig.isRegression()) {
    scoreColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(evalConfig.getPerformanceScoreSelector()));
    if (scoreColumnIndex < 0) {
      throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
    }
  }
  targetColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(modelConfig.getTargetColumnName(evalConfig)));
  if (targetColumnIndex < 0) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_TARGET_NOT_FOUND);
  }
  weightColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(evalConfig.getDataSet().getWeightColumnName()));
  multiClassScore1Index=targetColumnIndex + 2;
  multiClassModelCnt=CommonUtils.getBasicModelsCnt(modelConfig,evalConfig,evalConfig.getDataSet().getSource());
  metaColumns=evalConfig.getAllMetaColumns(modelConfig).size();
}

Fixed version (ground truth):
public ConfusionMatrix(ModelConfig modelConfig,EvalConfig evalConfig) throws IOException {
  this.modelConfig=modelConfig;
  this.evalConfig=evalConfig;
  String[] evalScoreHeader=getEvalScoreHeader();
  if (ArrayUtils.isEmpty(evalScoreHeader)) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_NO_EVALSCORE_HEADER);
  }
  if (StringUtils.isEmpty(evalConfig.getPerformanceScoreSelector())) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
  }
  if (modelConfig.isRegression()) {
    scoreColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(evalConfig.getPerformanceScoreSelector()));
    if (scoreColumnIndex < 0) {
      throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
    }
  }
  targetColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(modelConfig.getTargetColumnName(evalConfig)));
  if (targetColumnIndex < 0) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_TARGET_NOT_FOUND);
  }
  weightColumnIndex=getColumnIndex(evalScoreHeader,StringUtils.trimToEmpty(evalConfig.getDataSet().getWeightColumnName()));
  multiClassScore1Index=targetColumnIndex + 2;
  try {
    multiClassModelCnt=CommonUtils.getBasicModelsCnt(modelConfig,evalConfig,evalConfig.getDataSet().getSource());
  }
 catch (  java.io.FileNotFoundException e) {
    multiClassModelCnt=0;
  }
  metaColumns=evalConfig.getAllMetaColumns(modelConfig).size();
}
Program: 31773
Project: 31773
Buggy source:
public RunModelWorker(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,EvalConfig evalConfig,ActorRef parentActorRef,ActorRef nextActorRef) throws IOException {
  super(modelConfig,columnConfigList,parentActorRef,nextActorRef);
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,columnConfigList,evalConfig,SourceType.LOCAL);
  String[] header=null;
  String delimiter=null;
  if (null == evalConfig || null == evalConfig.getDataSet().getHeaderPath() || null == evalConfig.getDataSet().getHeaderDelimiter()) {
    header=CommonUtils.getFinalHeaders(modelConfig);
    delimiter=modelConfig.getDataSetDelimiter();
  }
 else {
    header=CommonUtils.getFinalHeaders(evalConfig);
    delimiter=evalConfig.getDataSet().getDataDelimiter();
  }
  modelRunner=new ModelRunner(modelConfig,columnConfigList,header,delimiter,models);
}

Fixed version (ground truth):
public RunModelWorker(ModelConfig modelConfig,List<ColumnConfig> columnConfigList,EvalConfig evalConfig,ActorRef parentActorRef,ActorRef nextActorRef) throws IOException {
  super(modelConfig,columnConfigList,parentActorRef,nextActorRef);
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,evalConfig,SourceType.LOCAL);
  String[] header=null;
  String delimiter=null;
  if (null == evalConfig || null == evalConfig.getDataSet().getHeaderPath() || null == evalConfig.getDataSet().getHeaderDelimiter()) {
    header=CommonUtils.getFinalHeaders(modelConfig);
    delimiter=modelConfig.getDataSetDelimiter();
  }
 else {
    header=CommonUtils.getFinalHeaders(evalConfig);
    delimiter=evalConfig.getDataSet().getDataDelimiter();
  }
  modelRunner=new ModelRunner(modelConfig,columnConfigList,header,delimiter,models);
}
Program: 31774
Project: 31774
Buggy source:
/** 
 * Write the file header for score file
 * @throws IOException if any ip exception
 */
private void writeScoreHeader() throws IOException {
  StringBuilder buf=new StringBuilder();
  buf.append(modelConfig.getTargetColumnName(evalConfig) == null ? "String_Node_Str" : modelConfig.getTargetColumnName(evalConfig));
  buf.append("String_Node_Str" + (StringUtils.isBlank(evalConfig.getDataSet().getWeightColumnName()) ? "String_Node_Str" : evalConfig.getDataSet().getWeightColumnName()));
  buf.append("String_Node_Str");
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,columnConfigList,evalConfig,SourceType.LOCAL);
  for (int i=0; i < models.size(); i++) {
    buf.append("String_Node_Str" + i);
  }
  List<String> metaColumns=evalConfig.getAllMetaColumns(modelConfig);
  if (CollectionUtils.isNotEmpty(metaColumns)) {
    for (    String columnName : metaColumns) {
      buf.append("String_Node_Str" + columnName);
    }
  }
  scoreWriter.write(buf.toString() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Write the file header for score file
 * @throws IOException if any ip exception
 */
private void writeScoreHeader() throws IOException {
  StringBuilder buf=new StringBuilder();
  buf.append(modelConfig.getTargetColumnName(evalConfig) == null ? "String_Node_Str" : modelConfig.getTargetColumnName(evalConfig));
  buf.append("String_Node_Str" + (StringUtils.isBlank(evalConfig.getDataSet().getWeightColumnName()) ? "String_Node_Str" : evalConfig.getDataSet().getWeightColumnName()));
  buf.append("String_Node_Str");
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,evalConfig,SourceType.LOCAL);
  for (int i=0; i < models.size(); i++) {
    buf.append("String_Node_Str" + i);
  }
  List<String> metaColumns=evalConfig.getAllMetaColumns(modelConfig);
  if (CollectionUtils.isNotEmpty(metaColumns)) {
    for (    String columnName : metaColumns) {
      buf.append("String_Node_Str" + columnName);
    }
  }
  scoreWriter.write(buf.toString() + "String_Node_Str");
}
Program: 31775
Project: 31775
Buggy source:
public ConfusionMatrix(ModelConfig modelConfig,EvalConfig evalConfig) throws IOException {
  this.modelConfig=modelConfig;
  this.evalConfig=evalConfig;
  String[] evalScoreHeader=getEvalScoreHeader();
  if (ArrayUtils.isEmpty(evalScoreHeader)) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_NO_EVALSCORE_HEADER);
  }
  if (StringUtils.isEmpty(evalConfig.getPerformanceScoreSelector())) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
  }
  if (modelConfig.isRegression()) {
    scoreColumnIndex=ArrayUtils.indexOf(evalScoreHeader,evalConfig.getPerformanceScoreSelector().trim());
    if (scoreColumnIndex < 0) {
      throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
    }
  }
  targetColumnIndex=ArrayUtils.indexOf(evalScoreHeader,modelConfig.getTargetColumnName(evalConfig));
  if (targetColumnIndex < 0) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_TARGET_NOT_FOUND);
  }
  weightColumnIndex=ArrayUtils.indexOf(evalScoreHeader,evalConfig.getDataSet().getWeightColumnName());
  multiClassScore1Index=targetColumnIndex + 2;
  multiClassModelCnt=(evalScoreHeader.length - multiClassScore1Index) / modelConfig.getTags().size();
}

Fixed version (ground truth):
public ConfusionMatrix(ModelConfig modelConfig,EvalConfig evalConfig) throws IOException {
  this.modelConfig=modelConfig;
  this.evalConfig=evalConfig;
  String[] evalScoreHeader=getEvalScoreHeader();
  if (ArrayUtils.isEmpty(evalScoreHeader)) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_NO_EVALSCORE_HEADER);
  }
  if (StringUtils.isEmpty(evalConfig.getPerformanceScoreSelector())) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
  }
  if (modelConfig.isRegression()) {
    scoreColumnIndex=ArrayUtils.indexOf(evalScoreHeader,evalConfig.getPerformanceScoreSelector().trim());
    if (scoreColumnIndex < 0) {
      throw new ShifuException(ShifuErrorCode.ERROR_EVAL_SELECTOR_EMPTY);
    }
  }
  targetColumnIndex=ArrayUtils.indexOf(evalScoreHeader,modelConfig.getTargetColumnName(evalConfig));
  if (targetColumnIndex < 0) {
    throw new ShifuException(ShifuErrorCode.ERROR_EVAL_TARGET_NOT_FOUND);
  }
  weightColumnIndex=ArrayUtils.indexOf(evalScoreHeader,evalConfig.getDataSet().getWeightColumnName());
  multiClassScore1Index=targetColumnIndex + 2;
  multiClassModelCnt=CommonUtils.getBasicModelsCnt(modelConfig,evalConfig,evalConfig.getDataSet().getSource());
  metaColumns=evalConfig.getAllMetaColumns(modelConfig).size();
}
Program: 31778
Project: 31778
Buggy source:
private LogisticRegressionParams initOrRecoverParams(MasterContext<LogisticRegressionParams,LogisticRegressionParams> context){
  LOG.info("String_Node_Str");
  LogisticRegressionParams params=null;
  try {
    Path modelPath=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
    LR existingModel=(LR)CommonUtils.loadModel(modelConfig,columnConfigList,modelPath,ShifuFileUtils.getFileSystemBySourceType(this.modelConfig.getDataSet().getSource()));
    if (existingModel == null) {
      params=initWeights();
      LOG.info("String_Node_Str");
    }
 else {
      params=initModelParams(existingModel);
      LOG.info("String_Node_Str",modelPath);
    }
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
  return params;
}

Fixed version (ground truth):
private LogisticRegressionParams initOrRecoverParams(MasterContext<LogisticRegressionParams,LogisticRegressionParams> context){
  LOG.info("String_Node_Str");
  LogisticRegressionParams params=null;
  try {
    Path modelPath=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
    LR existingModel=(LR)CommonUtils.loadModel(modelConfig,modelPath,ShifuFileUtils.getFileSystemBySourceType(this.modelConfig.getDataSet().getSource()));
    if (existingModel == null) {
      params=initWeights();
      LOG.info("String_Node_Str");
    }
 else {
      params=initModelParams(existingModel);
      LOG.info("String_Node_Str",modelPath);
    }
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
  return params;
}
Program: 31779
Project: 31779
Buggy source:
private NNParams initOrRecoverParams(MasterContext<NNParams,NNParams> context){
  NNParams params=null;
  try {
    Path modelPath=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
    BasicNetwork existingModel=(BasicNetwork)CommonUtils.loadModel(modelConfig,columnConfigList,modelPath,ShifuFileUtils.getFileSystemBySourceType(this.modelConfig.getDataSet().getSource()));
    if (existingModel == null) {
      params=initWeights();
      LOG.info("String_Node_Str");
    }
 else {
      params=initModelParams(existingModel);
      LOG.info("String_Node_Str",modelPath);
    }
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
  return params;
}

Fixed version (ground truth):
private NNParams initOrRecoverParams(MasterContext<NNParams,NNParams> context){
  NNParams params=null;
  try {
    Path modelPath=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
    BasicNetwork existingModel=(BasicNetwork)CommonUtils.loadModel(modelConfig,modelPath,ShifuFileUtils.getFileSystemBySourceType(this.modelConfig.getDataSet().getSource()));
    if (existingModel == null) {
      params=initWeights();
      LOG.info("String_Node_Str");
    }
 else {
      params=initModelParams(existingModel);
      LOG.info("String_Node_Str",modelPath);
    }
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
  return params;
}
Program: 31780
Project: 31780
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  loadTagWeightNum();
  this.dataPurifier=new DataPurifier(this.modelConfig);
  this.outputKey=new IntWritable();
  this.outputValue=new Text();
  this.tags=new HashSet<String>(modelConfig.getFlattenTags());
  SourceType sourceType=this.modelConfig.getDataSet().getSource();
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,columnConfigList,null,sourceType);
  this.headers=CommonUtils.getFinalHeaders(modelConfig);
  this.modelRunner=new ModelRunner(modelConfig,columnConfigList,this.headers,modelConfig.getDataSetDelimiter(),models);
  this.mos=new MultipleOutputs<NullWritable,Text>((TaskInputOutputContext)context);
  this.initFeatureStats();
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected void setup(Context context) throws IOException, InterruptedException {
  loadConfigFiles(context);
  loadTagWeightNum();
  this.dataPurifier=new DataPurifier(this.modelConfig);
  this.outputKey=new IntWritable();
  this.outputValue=new Text();
  this.tags=new HashSet<String>(modelConfig.getFlattenTags());
  SourceType sourceType=this.modelConfig.getDataSet().getSource();
  List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,null,sourceType);
  this.headers=CommonUtils.getFinalHeaders(modelConfig);
  this.modelRunner=new ModelRunner(modelConfig,columnConfigList,this.headers,modelConfig.getDataSetDelimiter(),models);
  this.mos=new MultipleOutputs<NullWritable,Text>((TaskInputOutputContext)context);
  this.initFeatureStats();
}
Program: 31781
Project: 31781
Buggy source:
private boolean inputOutputModelCheckSuccess(FileSystem fileSystem,Path modelPath) throws IOException {
  MLInputOutput model=(MLInputOutput)CommonUtils.loadModel(this.modelConfig,this.columnConfigList,modelPath,fileSystem);
  int[] outputCandidateCounts=DTrainUtils.getInputOutputCandidateCounts(getColumnConfigList());
  return model.getInputCount() == outputCandidateCounts[0] && model.getOutputCount() == outputCandidateCounts[1];
}

Fixed version (ground truth):
private boolean inputOutputModelCheckSuccess(FileSystem fileSystem,Path modelPath) throws IOException {
  MLInputOutput model=(MLInputOutput)CommonUtils.loadModel(this.modelConfig,modelPath,fileSystem);
  int[] outputCandidateCounts=DTrainUtils.getInputOutputCandidateCounts(getColumnConfigList());
  return model.getInputCount() == outputCandidateCounts[0] && model.getOutputCount() == outputCandidateCounts[1];
}
Program: 31784
Project: 31784
Buggy source:
/** 
 * Check is high rate is very high.
 */
private boolean isHighMissingRateColumn(ColumnConfig config){
  Double missingPercentage=config.getMissingPercentage();
  if (missingPercentage != null && missingPercentage >= modelConfig.getVarSelect().getMissingRateThreshold()) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check is missing rate is over threshold.
 */
private boolean isHighMissingRateColumn(ColumnConfig config){
  Double missingPercentage=config.getMissingPercentage();
  if (missingPercentage != null && missingPercentage >= modelConfig.getVarSelect().getMissingRateThreshold()) {
    return true;
  }
  return false;
}
Program: 31787
Project: 31787
Buggy source:
/** 
 * Since most user won't use this function, hidden the custom paths for creating new model.
 */
public String getName(){
  return name;
}

Fixed version (ground truth):
public String getName(){
  return name;
}
Program: 31788
Project: 31788
Buggy source:
/** 
 * Auto generated by eclipse
 */
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((author == null) ? 0 : author.hashCode());
  result=prime * result + ((description == null) ? 0 : description.hashCode());
  result=prime * result + ((name == null) ? 0 : name.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((author == null) ? 0 : author.hashCode());
  result=prime * result + ((description == null) ? 0 : description.hashCode());
  result=prime * result + ((name == null) ? 0 : name.hashCode());
  return result;
}
Program: 31790
Project: 31790
Buggy source:
@JsonIgnore public List<String> getScoreMetaColumns(ModelConfig modelConfig) throws IOException {
  if (scoreMetaColumns == null) {
synchronized (this) {
      if (scoreMetaColumns == null) {
        if (StringUtils.isNotBlank(scoreMetaColumnNameFile)) {
          String path=scoreMetaColumnNameFile;
          if (SourceType.HDFS.equals(dataSet.getSource())) {
            PathFinder pathFinder=new PathFinder(modelConfig);
            File file=new File(scoreMetaColumnNameFile);
            path=new Path(pathFinder.getEvalSetPath(this),file.getName()).toString();
          }
          String delimiter=StringUtils.isBlank(dataSet.getHeaderDelimiter()) ? dataSet.getDataDelimiter() : dataSet.getHeaderDelimiter();
          scoreMetaColumns=CommonUtils.readConfFileIntoList(path,dataSet.getSource(),delimiter);
        }
      }
    }
  }
  return scoreMetaColumns;
}

Fixed version (ground truth):
@JsonIgnore public List<String> getScoreMetaColumns(ModelConfig modelConfig) throws IOException {
  if (scoreMetaColumns == null) {
synchronized (this) {
      if (scoreMetaColumns == null) {
        if (StringUtils.isNotBlank(scoreMetaColumnNameFile)) {
          String path=scoreMetaColumnNameFile;
          if (SourceType.HDFS.equals(dataSet.getSource())) {
            PathFinder pathFinder=new PathFinder(modelConfig);
            File file=new File(scoreMetaColumnNameFile);
            path=new Path(pathFinder.getEvalSetPath(this),file.getName()).toString();
          }
          String delimiter=StringUtils.isBlank(dataSet.getHeaderDelimiter()) ? dataSet.getDataDelimiter() : dataSet.getHeaderDelimiter();
          scoreMetaColumns=CommonUtils.readConfFileIntoList(path,dataSet.getSource(),delimiter);
        }
        if (this.scoreMetaColumns == null) {
          this.scoreMetaColumns=new ArrayList<String>();
        }
      }
    }
  }
  return scoreMetaColumns;
}
Program: 31791
Project: 31791
Buggy source:
@JsonIgnore public List<String> getAllMetaColumns(ModelConfig modelConfig) throws IOException {
  if (metaColumns == null) {
synchronized (this) {
      if (metaColumns == null) {
        List<String> scoreMetaColumns=getScoreMetaColumns(modelConfig);
        if (scoreMetaColumns != null) {
          this.metaColumns=new ArrayList<String>(scoreMetaColumns);
        }
        String metaColumnNameFile=dataSet.getMetaColumnNameFile();
        if (StringUtils.isNotBlank(metaColumnNameFile)) {
          String path=metaColumnNameFile;
          if (SourceType.HDFS.equals(dataSet.getSource())) {
            PathFinder pathFinder=new PathFinder(modelConfig);
            File file=new File(metaColumnNameFile);
            path=new Path(pathFinder.getEvalSetPath(this),file.getName()).toString();
          }
          String delimiter=StringUtils.isBlank(dataSet.getHeaderDelimiter()) ? dataSet.getDataDelimiter() : dataSet.getHeaderDelimiter();
          List<String> rawMetaColumns=CommonUtils.readConfFileIntoList(path,dataSet.getSource(),delimiter);
          if (CollectionUtils.isNotEmpty(metaColumns)) {
            for (            String column : rawMetaColumns) {
              if (!metaColumns.contains(column)) {
                metaColumns.add(column);
              }
            }
          }
 else {
            metaColumns=rawMetaColumns;
          }
        }
      }
    }
  }
  return metaColumns;
}

Fixed version (ground truth):
@JsonIgnore public List<String> getAllMetaColumns(ModelConfig modelConfig) throws IOException {
  if (metaColumns == null) {
synchronized (this) {
      if (metaColumns == null) {
        List<String> scoreMetaColumns=getScoreMetaColumns(modelConfig);
        if (scoreMetaColumns != null) {
          this.metaColumns=new ArrayList<String>(scoreMetaColumns);
        }
        String metaColumnNameFile=dataSet.getMetaColumnNameFile();
        if (StringUtils.isNotBlank(metaColumnNameFile)) {
          String path=metaColumnNameFile;
          if (SourceType.HDFS.equals(dataSet.getSource())) {
            PathFinder pathFinder=new PathFinder(modelConfig);
            File file=new File(metaColumnNameFile);
            path=new Path(pathFinder.getEvalSetPath(this),file.getName()).toString();
          }
          String delimiter=StringUtils.isBlank(dataSet.getHeaderDelimiter()) ? dataSet.getDataDelimiter() : dataSet.getHeaderDelimiter();
          List<String> rawMetaColumns=CommonUtils.readConfFileIntoList(path,dataSet.getSource(),delimiter);
          if (CollectionUtils.isNotEmpty(metaColumns)) {
            for (            String column : rawMetaColumns) {
              if (!metaColumns.contains(column)) {
                metaColumns.add(column);
              }
            }
          }
 else {
            metaColumns=rawMetaColumns;
          }
        }
        if (this.metaColumns == null) {
          this.metaColumns=new ArrayList<String>();
        }
      }
    }
  }
  return metaColumns;
}
Program: 31792
Project: 31792
Buggy source:
/** 
 * Convert column name into PMML format(with normalization)
 * @param columnName the column name
 * @param normType the norm type
 * @return - PMML standard column name
 */
protected String genPmmlColumnName(String columnName,ModelNormalizeConf.NormType normType){
  return columnName + "String_Node_Str" + normType.name().toLowerCase();
}

Fixed version (ground truth):
/** 
 * Convert column name into PMML format(with normalization)
 * @param columnName the column name
 * @param normType the norm type
 * @return - PMML standard column name
 */
public static String genPmmlColumnName(String columnName,ModelNormalizeConf.NormType normType){
  return columnName + "String_Node_Str" + normType.name().toLowerCase();
}
Program: 31793
Project: 31793
Buggy source:
/** 
 * Run pig code to normalize evaluation dataset
 * @param evalConfig
 * @throws IOException
 */
private void runPigNormalize(EvalConfig evalConfig) throws IOException {
  SourceType sourceType=evalConfig.getDataSet().getSource();
  ShifuFileUtils.deleteFile(pathFinder.getEvalNormalizedPath(evalConfig),sourceType);
  Map<String,String> paramsMap=new HashMap<String,String>();
  paramsMap.put(Constants.SOURCE_TYPE,sourceType.toString());
  paramsMap.put("String_Node_Str",evalConfig.getDataSet().getDataPath());
  paramsMap.put("String_Node_Str",pathFinder.getEvalNormalizedPath(evalConfig));
  paramsMap.put("String_Node_Str",evalConfig.getName());
  paramsMap.put("String_Node_Str",evalConfig.getDataSet().getDataDelimiter());
  String pigScript="String_Node_Str";
  try {
    PigExecutor.getExecutor().submitJob(modelConfig,pathFinder.getScriptPath(pigScript),paramsMap,evalConfig.getDataSet().getSource());
  }
 catch (  IOException e) {
    throw new ShifuException(ShifuErrorCode.ERROR_RUNNING_PIG_JOB,e);
  }
catch (  Throwable e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Run pig code to normalize evaluation dataset
 * @param evalConfig
 * @throws IOException
 */
private void runPigNormalize(EvalConfig evalConfig) throws IOException {
  SourceType sourceType=evalConfig.getDataSet().getSource();
  ShifuFileUtils.deleteFile(pathFinder.getEvalNormalizedPath(evalConfig),sourceType);
  Map<String,String> paramsMap=new HashMap<String,String>();
  paramsMap.put(Constants.SOURCE_TYPE,sourceType.toString());
  paramsMap.put("String_Node_Str",evalConfig.getDataSet().getDataPath());
  paramsMap.put("String_Node_Str",pathFinder.getEvalNormalizedPath(evalConfig));
  paramsMap.put("String_Node_Str",evalConfig.getName());
  paramsMap.put("String_Node_Str",evalConfig.getDataSet().getDataDelimiter());
  paramsMap.put("String_Node_Str",Environment.getProperty(Constants.SHIFU_SCORE_SCALE,Integer.toString(Scorer.DEFAULT_SCORE_SCALE)));
  String pigScript="String_Node_Str";
  try {
    PigExecutor.getExecutor().submitJob(modelConfig,pathFinder.getScriptPath(pigScript),paramsMap,evalConfig.getDataSet().getSource());
  }
 catch (  IOException e) {
    throw new ShifuException(ShifuErrorCode.ERROR_RUNNING_PIG_JOB,e);
  }
catch (  Throwable e) {
    throw new RuntimeException(e);
  }
}
Program: 31794
Project: 31794
Buggy source:
/** 
 * output the schema for evaluation score
 */
public Schema outputSchema(Schema input){
  try {
    Schema tupleSchema=new Schema();
    for (int i=0; i < this.outputNames.size(); i++) {
      String name=this.outputNames.get(i);
      if (i < 2 + validMetaSize) {
        tupleSchema.add(new FieldSchema(name,DataType.CHARARRAY));
      }
 else {
        tupleSchema.add(new FieldSchema(name,DataType.DOUBLE));
      }
    }
    return new Schema(new FieldSchema("String_Node_Str",tupleSchema,DataType.TUPLE));
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * output the schema for evaluation score
 */
public Schema outputSchema(Schema input){
  try {
    Schema tupleSchema=new Schema();
    for (int i=0; i < this.outputNames.size(); i++) {
      String name=this.outputNames.get(i);
      if (i < 2 + validMetaSize) {
        tupleSchema.add(new FieldSchema(name,DataType.CHARARRAY));
      }
 else {
        tupleSchema.add(new FieldSchema(ZscoreLocalTransformCreator.genPmmlColumnName(name,this.modelConfig.getNormalizeType()),DataType.DOUBLE));
      }
    }
    tupleSchema.add(new FieldSchema(this.scoreName,DataType.DOUBLE));
    return new Schema(new FieldSchema("String_Node_Str",tupleSchema,DataType.TUPLE));
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    return null;
  }
}
Program: 31796
Project: 31796
Buggy source:
public Tuple exec(Tuple input) throws IOException {
  Map<String,String> rawDataMap=CommonUtils.convertDataIntoMap(input,this.headers);
  Tuple tuple=TupleFactory.getInstance().newTuple(this.outputNames.size());
  for (int i=0; i < this.outputNames.size(); i++) {
    String name=this.outputNames.get(i);
    String raw=rawDataMap.get(name);
    if (i == 0) {
      tuple.set(i,raw);
    }
 else     if (i == 1) {
      tuple.set(i,(StringUtils.isEmpty(raw) ? "String_Node_Str" : raw));
    }
 else     if (i > 1 && i < 2 + validMetaSize) {
      tuple.set(i,raw);
    }
 else {
      ColumnConfig columnConfig=this.columnConfigMap.get(name);
      Double value=Normalizer.normalize(columnConfig,raw,this.modelConfig.getNormalizeStdDevCutOff(),this.modelConfig.getNormalizeType());
      tuple.set(i,value);
    }
  }
  return tuple;
}

Fixed version (ground truth):
public Tuple exec(Tuple input) throws IOException {
  if (this.modelRunner == null) {
    List<BasicML> models=CommonUtils.loadBasicModels(modelConfig,this.columnConfigList,evalConfig,evalConfig.getDataSet().getSource(),evalConfig.getGbtConvertToProb());
    this.modelRunner=new ModelRunner(modelConfig,columnConfigList,this.headers,evalConfig.getDataSet().getDataDelimiter(),models);
    this.modelRunner.setScoreScale(Integer.parseInt(this.scale));
  }
  Map<String,String> rawDataMap=CommonUtils.convertDataIntoMap(input,this.headers);
  Tuple tuple=TupleFactory.getInstance().newTuple(this.outputNames.size() + 1);
  for (int i=0; i < this.outputNames.size(); i++) {
    String name=this.outputNames.get(i);
    String raw=rawDataMap.get(name);
    if (i == 0) {
      tuple.set(i,raw);
    }
 else     if (i == 1) {
      tuple.set(i,(StringUtils.isEmpty(raw) ? "String_Node_Str" : raw));
    }
 else     if (i > 1 && i < 2 + validMetaSize) {
      tuple.set(i,raw);
    }
 else {
      ColumnConfig columnConfig=this.columnConfigMap.get(name);
      Double value=Normalizer.normalize(columnConfig,raw,this.modelConfig.getNormalizeStdDevCutOff(),this.modelConfig.getNormalizeType());
      tuple.set(i,value);
    }
  }
  CaseScoreResult score=this.modelRunner.compute(rawDataMap);
  if (score == null) {
    tuple.set(this.outputNames.size(),-999.0);
  }
 else   if (this.scIndex < 0) {
    tuple.set(this.outputNames.size(),score.getAvgScore());
  }
 else {
    tuple.set(this.outputNames.size(),score.getScores().get(this.scIndex));
  }
  return tuple;
}