Program: 32036
Project: 32036
Buggy source:
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<DTMasterParams,DTWorkerParams> context){
  this.count+=1;
  if ((this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  float[] numericInputs=new float[this.numericInputCount];
  String[] categoricalInputs=new String[this.categoricalInputCount];
  float ideal=0f;
  float significance=1f;
  int index=0, numericInputsIndex=0, categoricalInputsIndex=0;
  for (  String input : DEFAULT_SPLITTER.split(currentValue.getWritable().toString())) {
    float floatValue=NumberFormatUtils.getFloat(input,0f);
    if (Float.isNaN(floatValue) || Double.isNaN(floatValue)) {
      floatValue=0f;
    }
    if (index == this.columnConfigList.size()) {
      significance=NumberFormatUtils.getFloat(input,1f);
      break;
    }
 else {
      ColumnConfig columnConfig=this.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        ideal=floatValue;
      }
 else {
        if (!isAfterVarSelect) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            if (columnConfig.isNumerical()) {
              numericInputs[numericInputsIndex]=floatValue;
              this.numericInputIndexMap.put(columnConfig.getColumnNum(),numericInputsIndex);
              numericInputsIndex+=1;
            }
 else             if (columnConfig.isCategorical()) {
              if (input == null) {
                categoricalInputs[categoricalInputsIndex]="String_Node_Str";
              }
 else {
                categoricalInputs[categoricalInputsIndex]=input;
              }
              this.categoricalInputIndexMap.put(columnConfig.getColumnNum(),categoricalInputsIndex);
              categoricalInputsIndex+=1;
            }
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            if (columnConfig.isNumerical()) {
              numericInputs[numericInputsIndex]=floatValue;
              this.numericInputIndexMap.put(columnConfig.getColumnNum(),numericInputsIndex);
              numericInputsIndex+=1;
            }
 else             if (columnConfig.isCategorical()) {
              if (input == null) {
                categoricalInputs[categoricalInputsIndex]="String_Node_Str";
              }
 else {
                categoricalInputs[categoricalInputsIndex]=input;
              }
              this.categoricalInputIndexMap.put(columnConfig.getColumnNum(),categoricalInputsIndex);
              categoricalInputsIndex+=1;
            }
          }
        }
      }
    }
    index+=1;
  }
  float[] sampleWeights;
  if (this.treeNum == 1 || this.isGBDT) {
    sampleWeights=new float[this.treeNum];
    if (random.nextDouble() <= modelConfig.getTrain().getBaggingSampleRate()) {
      sampleWeights[0]=1f;
    }
 else {
      sampleWeights[0]=0f;
    }
    for (int i=1; i < sampleWeights.length; i++) {
      sampleWeights[i]=1f;
    }
  }
 else {
    sampleWeights=new float[this.treeNum];
    for (int i=0; i < sampleWeights.length; i++) {
      sampleWeights[i]=this.rng[i].sample();
    }
  }
  float output=ideal;
  float predict=ideal;
  Data data=new Data(numericInputs,categoricalInputs,predict,output,output,significance,sampleWeights);
  boolean isNeedFailOver=!context.isFirstIteration();
  if (isNeedFailOver && this.isGBDT) {
    DTMasterParams lastMasterResult=context.getLastMasterResult();
    if (lastMasterResult != null) {
      List<TreeNode> trees=lastMasterResult.getTrees();
      if (trees.size() > 1) {
        for (int i=0; i < trees.size() - 1; i++) {
          TreeNode currTree=trees.get(i);
          if (i == 0) {
            double oldPredict=predictNodeIndex(currTree.getNode(),data).getPredict().getPredict();
            predict=(float)oldPredict;
            output=-loss.computeGradient(predict,data.label);
          }
 else {
            double oldPredict=predictNodeIndex(currTree.getNode(),data).getPredict().getPredict();
            predict+=(float)(this.learningRate * oldPredict);
            output=-loss.computeGradient(predict,data.label);
          }
        }
        data.output=output;
        data.predict=predict;
      }
    }
  }
  this.trainingData.append(data);
}

Fixed version (ground truth):
@Override public void load(GuaguaWritableAdapter<LongWritable> currentKey,GuaguaWritableAdapter<Text> currentValue,WorkerContext<DTMasterParams,DTWorkerParams> context){
  this.count+=1;
  if ((this.count) % 100000 == 0) {
    LOG.info("String_Node_Str",this.count);
  }
  float[] numericInputs=new float[this.numericInputCount];
  String[] categoricalInputs=new String[this.categoricalInputCount];
  float ideal=0f;
  float significance=1f;
  int index=0, numericInputsIndex=0, categoricalInputsIndex=0;
  for (  String input : DEFAULT_SPLITTER.split(currentValue.getWritable().toString())) {
    float floatValue=NumberFormatUtils.getFloat(input,0f);
    if (Float.isNaN(floatValue) || Double.isNaN(floatValue)) {
      floatValue=0f;
    }
    if (index == this.columnConfigList.size()) {
      significance=NumberFormatUtils.getFloat(input,1f);
      break;
    }
 else {
      ColumnConfig columnConfig=this.columnConfigList.get(index);
      if (columnConfig != null && columnConfig.isTarget()) {
        ideal=floatValue;
      }
 else {
        if (!isAfterVarSelect) {
          if (!columnConfig.isMeta() && !columnConfig.isTarget() && CommonUtils.isGoodCandidate(columnConfig)) {
            if (columnConfig.isNumerical()) {
              numericInputs[numericInputsIndex]=floatValue;
              this.numericInputIndexMap.put(columnConfig.getColumnNum(),numericInputsIndex);
              numericInputsIndex+=1;
            }
 else             if (columnConfig.isCategorical()) {
              if (input == null) {
                categoricalInputs[categoricalInputsIndex]="String_Node_Str";
              }
 else {
                categoricalInputs[categoricalInputsIndex]=input;
              }
              this.categoricalInputIndexMap.put(columnConfig.getColumnNum(),categoricalInputsIndex);
              categoricalInputsIndex+=1;
            }
          }
        }
 else {
          if (columnConfig != null && !columnConfig.isMeta() && !columnConfig.isTarget() && columnConfig.isFinalSelect()) {
            if (columnConfig.isNumerical()) {
              numericInputs[numericInputsIndex]=floatValue;
              this.numericInputIndexMap.put(columnConfig.getColumnNum(),numericInputsIndex);
              numericInputsIndex+=1;
            }
 else             if (columnConfig.isCategorical()) {
              if (input == null) {
                categoricalInputs[categoricalInputsIndex]="String_Node_Str";
              }
 else {
                categoricalInputs[categoricalInputsIndex]=input;
              }
              this.categoricalInputIndexMap.put(columnConfig.getColumnNum(),categoricalInputsIndex);
              categoricalInputsIndex+=1;
            }
          }
        }
      }
    }
    index+=1;
  }
  float[] sampleWeights;
  if (this.treeNum == 1 || this.isGBDT) {
    sampleWeights=new float[this.treeNum];
    if (random.nextDouble() <= modelConfig.getTrain().getBaggingSampleRate()) {
      sampleWeights[0]=1f;
    }
 else {
      sampleWeights[0]=0f;
    }
    for (int i=1; i < sampleWeights.length; i++) {
      sampleWeights[i]=1f;
    }
  }
 else {
    sampleWeights=new float[this.treeNum];
    for (int i=0; i < sampleWeights.length; i++) {
      sampleWeights[i]=this.rng[i].sample();
    }
  }
  float output=ideal;
  float predict=ideal;
  Data data=new Data(numericInputs,categoricalInputs,predict,output,output,significance,sampleWeights);
  boolean isNeedFailOver=!context.isFirstIteration();
  if (isNeedFailOver && this.isGBDT) {
    DTMasterParams lastMasterResult=context.getLastMasterResult();
    if (lastMasterResult != null) {
      List<TreeNode> trees=lastMasterResult.getTrees();
      if (trees.size() > 1) {
        int iterLen=lastMasterResult.isSwitchToNextTree() ? trees.size() - 2 : trees.size() - 1;
        for (int i=0; i < iterLen; i++) {
          TreeNode currTree=trees.get(i);
          if (i == 0) {
            double oldPredict=predictNodeIndex(currTree.getNode(),data).getPredict().getPredict();
            predict=(float)oldPredict;
            output=-1f * loss.computeGradient(predict,data.label);
          }
 else {
            double oldPredict=predictNodeIndex(currTree.getNode(),data).getPredict().getPredict();
            predict+=(float)(this.learningRate * oldPredict);
            output=-1f * loss.computeGradient(predict,data.label);
          }
        }
        data.output=output;
        data.predict=predict;
      }
    }
  }
  this.trainingData.append(data);
}