Program: 31822
Project: 31822
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<NNParams,NNParams> workerContext){
  super.count+=1;
  if ((super.count) % 5000 == 0) {
    LOG.info("String_Node_Str",super.count);
  }
  float[] inputs=new float[super.inputNodeCount];
  float[] ideal=new float[super.outputNodeCount];
  if (super.isDry) {
    addDataPairToDataSet(0,new BasicFloatMLDataPair(new BasicFloatMLData(inputs),new BasicFloatMLData(ideal)));
    return;
  }
  long hashcode=0;
  float significance=1f;
  int index=0, inputsIndex=0, outputIndex=0;
  for (  String input : DEFAULT_SPLITTER.split(currentValue.getWritable().toString())) {
    float floatValue=input.length() == 0 ? 0f : NumberFormatUtils.getFloat(input,0f);
    floatValue=(Float.isNaN(floatValue) || Double.isNaN(floatValue)) ? 0f : floatValue;
    if (index == super.columnConfigList.size()) {
      significance=input.length() == 0 ? 1f : NumberFormatUtils.getFloat(input,1f);
      break;
    }
 else {
      ColumnConfig columnConfig=super.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        if (modelConfig.isRegression()) {
          ideal[outputIndex++]=floatValue;
        }
 else {
          if (modelConfig.getTrain().isOneVsAll()) {
            ideal[outputIndex++]=Float.compare(floatValue,trainerId) == 0 ? 1f : 0f;
          }
 else {
            int ideaIndex=(int)floatValue;
            ideal[ideaIndex]=1f;
          }
        }
      }
 else {
        if (super.inputNodeCount == super.candidateCount) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            inputs[inputsIndex++]=floatValue;
            hashcode=hashcode * 31 + Double.valueOf(floatValue).hashCode();
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            inputs[inputsIndex++]=floatValue;
            hashcode=hashcode * 31 + Double.valueOf(floatValue).hashCode();
          }
        }
      }
    }
    index+=1;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && Double.compare(ideal[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(ideal[0] + 0.01d,0d) == 0 && this.modelConfig.isFixInitialInput() && hashcode % 100 >= Double.valueOf(this.modelConfig.getBaggingSampleRate() * 100).longValue())) {
    return;
  }
  FloatMLDataPair pair=new BasicFloatMLDataPair(new BasicFloatMLData(inputs),new BasicFloatMLData(ideal));
  if (modelConfig.isRegression() && isUpSampleEnabled() && Double.compare(ideal[0],1d) == 0) {
    pair.setSignificance(significance * (super.upSampleRng.sample() + 1));
  }
 else {
    pair.setSignificance(significance);
  }
  boolean isValidation=false;
  if (workerContext.getAttachment() != null && workerContext.getAttachment() instanceof Boolean) {
    isValidation=(Boolean)workerContext.getAttachment();
  }
  boolean isInTraining=addDataPairToDataSet(hashcode,pair,isValidation);
  if (isInTraining) {
    float subsampleWeights=sampleWeights(pair.getIdealArray()[0]);
    if (isPositive(pair.getIdealArray()[0])) {
      this.positiveSelectedTrainCount+=subsampleWeights * 1L;
    }
 else {
      this.negativeSelectedTrainCount+=subsampleWeights * 1L;
    }
    pair.setSignificance(pair.getSignificance() * subsampleWeights);
  }
 else {
  }
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<NNParams,NNParams> workerContext){
  super.count+=1;
  if ((super.count) % 5000 == 0) {
    LOG.info("String_Node_Str",super.count);
  }
  float[] inputs=new float[super.inputNodeCount];
  float[] ideal=new float[super.outputNodeCount];
  if (super.isDry) {
    addDataPairToDataSet(0,new BasicFloatMLDataPair(new BasicFloatMLData(inputs),new BasicFloatMLData(ideal)));
    return;
  }
  long hashcode=0;
  float significance=1f;
  int index=0, inputsIndex=0, outputIndex=0;
  for (  String input : DEFAULT_SPLITTER.split(currentValue.getWritable().toString())) {
    float floatValue=input.length() == 0 ? 0f : NumberFormatUtils.getFloat(input,0f);
    floatValue=(Float.isNaN(floatValue) || Double.isNaN(floatValue)) ? 0f : floatValue;
    if (index == super.columnConfigList.size()) {
      significance=input.length() == 0 ? 1f : NumberFormatUtils.getFloat(input,1f);
      if (Float.compare(significance,0f) < 0) {
        LOG.warn("String_Node_Str",count,significance);
        significance=1f;
      }
      break;
    }
 else {
      ColumnConfig columnConfig=super.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        if (modelConfig.isRegression()) {
          ideal[outputIndex++]=floatValue;
        }
 else {
          if (modelConfig.getTrain().isOneVsAll()) {
            ideal[outputIndex++]=Float.compare(floatValue,trainerId) == 0 ? 1f : 0f;
          }
 else {
            int ideaIndex=(int)floatValue;
            ideal[ideaIndex]=1f;
          }
        }
      }
 else {
        if (super.inputNodeCount == super.candidateCount) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            inputs[inputsIndex++]=floatValue;
            hashcode=hashcode * 31 + Double.valueOf(floatValue).hashCode();
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            inputs[inputsIndex++]=floatValue;
            hashcode=hashcode * 31 + Double.valueOf(floatValue).hashCode();
          }
        }
      }
    }
    index+=1;
  }
  if (modelConfig.getTrain().getSampleNegOnly() && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll())) && Double.compare(ideal[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(ideal[0] + 0.01d,0d) == 0 && this.modelConfig.isFixInitialInput() && hashcode % 100 >= Double.valueOf(this.modelConfig.getBaggingSampleRate() * 100).longValue())) {
    return;
  }
  FloatMLDataPair pair=new BasicFloatMLDataPair(new BasicFloatMLData(inputs),new BasicFloatMLData(ideal));
  if (modelConfig.isRegression() && isUpSampleEnabled() && Double.compare(ideal[0],1d) == 0) {
    pair.setSignificance(significance * (super.upSampleRng.sample() + 1));
  }
 else {
    pair.setSignificance(significance);
  }
  boolean isValidation=false;
  if (workerContext.getAttachment() != null && workerContext.getAttachment() instanceof Boolean) {
    isValidation=(Boolean)workerContext.getAttachment();
  }
  boolean isInTraining=addDataPairToDataSet(hashcode,pair,isValidation);
  if (isInTraining) {
    float subsampleWeights=sampleWeights(pair.getIdealArray()[0]);
    if (isPositive(pair.getIdealArray()[0])) {
      this.positiveSelectedTrainCount+=subsampleWeights * 1L;
    }
 else {
      this.negativeSelectedTrainCount+=subsampleWeights * 1L;
    }
    pair.setSignificance(pair.getSignificance() * subsampleWeights);
  }
 else {
  }
}