Program: 31859
Project: 31859
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<LogisticRegressionParams,LogisticRegressionParams> context){
  ++this.count;
  if ((this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String line=currentValue.getWritable().toString();
  float[] inputData=new float[inputNum];
  float[] outputData=new float[outputNum];
  int index=0, inputIndex=0, outputIndex=0;
  long hashcode=0;
  double significance=CommonConstants.DEFAULT_SIGNIFICANCE_VALUE;
  for (  String unit : splitter.split(line)) {
    float floatValue=unit.length() == 0 ? 0f : NumberFormatUtils.getFloat(unit,0f);
    floatValue=(Float.isNaN(floatValue) || Double.isNaN(floatValue)) ? 0f : floatValue;
    if (index == this.columnConfigList.size()) {
      significance=unit.length() == 0 ? 1f : NumberFormatUtils.getDouble(unit,1d);
      if (Double.compare(significance,0d) < 0) {
        LOG.warn("String_Node_Str",count,significance);
        significance=1d;
      }
      break;
    }
 else {
      ColumnConfig columnConfig=this.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        outputData[outputIndex++]=floatValue;
      }
 else {
        if (this.inputNum == this.candidateNum) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            inputData[inputIndex++]=floatValue;
            hashcode=hashcode * 31 + Float.valueOf(floatValue).hashCode();
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            inputData[inputIndex++]=floatValue;
            hashcode=hashcode * 31 + Float.valueOf(floatValue).hashCode();
          }
        }
      }
    }
    index+=1;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && Double.compare(outputData[0] + 0.01d,0d) == 0 && (!this.modelConfig.isFixInitialInput() && Double.compare(Math.random(),this.modelConfig.getBaggingSampleRate()) >= 0)) {
    return;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && (Double.compare(outputData[0] + 0.01d,0d) == 0 && this.modelConfig.isFixInitialInput() && hashcode % 100 >= Double.valueOf(this.modelConfig.getBaggingSampleRate() * 100).longValue())) {
    return;
  }
  Data data=new Data(inputData,outputData,significance);
  if (modelConfig.isRegression() && isUpSampleEnabled() && Double.compare(outputData[0],1d) == 0) {
    data.setSignificance(data.significance * (this.upSampleRng.sample() + 1));
  }
  boolean isValidation=false;
  if (context.getAttachment() != null && context.getAttachment() instanceof Boolean) {
    isValidation=(Boolean)context.getAttachment();
  }
  boolean isInTraining=addDataPairToDataSet(hashcode,data,isValidation);
  if (isInTraining) {
    float subsampleWeights=sampleWeights(outputData[0]);
    if (isPositive(outputData[0])) {
      this.positiveSelectedTrainCount+=subsampleWeights * 1L;
    }
 else {
      this.negativeSelectedTrainCount+=subsampleWeights * 1L;
    }
    data.setSignificance(data.significance * subsampleWeights);
  }
 else {
  }
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<LogisticRegressionParams,LogisticRegressionParams> context){
  ++this.count;
  if ((this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  String line=currentValue.getWritable().toString();
  float[] inputData=new float[inputNum];
  float[] outputData=new float[outputNum];
  int index=0, inputIndex=0, outputIndex=0;
  long hashcode=0;
  double significance=CommonConstants.DEFAULT_SIGNIFICANCE_VALUE;
  for (  String unit : splitter.split(line)) {
    float floatValue=unit.length() == 0 ? 0f : NumberFormatUtils.getFloat(unit,0f);
    floatValue=(Float.isNaN(floatValue) || Double.isNaN(floatValue)) ? 0f : floatValue;
    if (index == this.columnConfigList.size()) {
      if (StringUtils.isBlank(modelConfig.getWeightColumnName())) {
        significance=1d;
        break;
      }
      significance=unit.length() == 0 ? 1f : NumberFormatUtils.getDouble(unit,1d);
      if (Double.compare(significance,0d) < 0) {
        LOG.warn("String_Node_Str",count,significance);
        significance=1d;
      }
      break;
    }
 else {
      ColumnConfig columnConfig=this.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        outputData[outputIndex++]=floatValue;
      }
 else {
        if (this.inputNum == this.candidateNum) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            inputData[inputIndex++]=floatValue;
            hashcode=hashcode * 31 + Float.valueOf(floatValue).hashCode();
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            inputData[inputIndex++]=floatValue;
            hashcode=hashcode * 31 + Float.valueOf(floatValue).hashCode();
          }
        }
      }
    }
    index+=1;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && Double.compare(outputData[0] + 0.01d,0d) == 0 && (!this.modelConfig.isFixInitialInput() && Double.compare(Math.random(),this.modelConfig.getBaggingSampleRate()) >= 0)) {
    return;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && (Double.compare(outputData[0] + 0.01d,0d) == 0 && this.modelConfig.isFixInitialInput() && hashcode % 100 >= Double.valueOf(this.modelConfig.getBaggingSampleRate() * 100).longValue())) {
    return;
  }
  Data data=new Data(inputData,outputData,significance);
  if (modelConfig.isRegression() && isUpSampleEnabled() && Double.compare(outputData[0],1d) == 0) {
    data.setSignificance(data.significance * (this.upSampleRng.sample() + 1));
  }
  boolean isValidation=false;
  if (context.getAttachment() != null && context.getAttachment() instanceof Boolean) {
    isValidation=(Boolean)context.getAttachment();
  }
  boolean isInTraining=addDataPairToDataSet(hashcode,data,isValidation);
  if (isInTraining) {
    float subsampleWeights=sampleWeights(outputData[0]);
    if (isPositive(outputData[0])) {
      this.positiveSelectedTrainCount+=subsampleWeights * 1L;
    }
 else {
      this.negativeSelectedTrainCount+=subsampleWeights * 1L;
    }
    data.setSignificance(data.significance * subsampleWeights);
  }
 else {
  }
}