Program: 32057
Project: 32057
Buggy source:
public ScoreObject score(MLDataPair pair,Map<String,String> rawDataMap){
  if (pair == null) {
    return null;
  }
  List<Integer> scores=new ArrayList<Integer>();
  if (modelConfig != null && (modelConfig.getAlgorithm().equalsIgnoreCase(CommonConstants.GBDT_ALG_NAME) || modelConfig.getAlgorithm().equalsIgnoreCase(CommonConstants.RF_ALG_NAME))) {
    double learningRate=Double.valueOf(this.modelConfig.getParams().get(NNTrainer.LEARNING_RATE).toString());
    BasicML model=models.get(0);
    if (model instanceof TreeModel) {
      TreeModel trees=(TreeModel)model;
      if (trees.getInputCount() != pair.getInput().size()) {
        log.error("String_Node_Str" + trees.getInputCount() + "String_Node_Str"+ pair.getInput().size());
      }
      List<TreeNode> treeNodes=trees.getTrees();
      String algorithm=modelConfig.getAlgorithm();
      List<Double> weights=new ArrayList<Double>(treeNodes.size());
      for (int i=0; i < treeNodes.size(); i++) {
        if (CommonConstants.RF_ALG_NAME.equalsIgnoreCase(algorithm)) {
          weights.add(1d);
        }
        if (CommonConstants.GBDT_ALG_NAME.equalsIgnoreCase(algorithm)) {
          if (i == 0) {
            weights.add(1d);
          }
 else {
            weights.add(learningRate);
          }
        }
      }
      TreeModel treeModel=new TreeModel(treeNodes,weights,CommonConstants.GBDT_ALG_NAME.equalsIgnoreCase(algorithm),columnConfigList,columnMapping);
      MLData internalScore=treeModel.compute(pair.getInput());
      scores.add(toScore(internalScore.getData(0)));
    }
  }
 else {
    for (    BasicML model : models) {
      if (model instanceof BasicNetwork) {
        BasicNetwork network=(BasicNetwork)model;
        if (network.getInputCount() != pair.getInput().size()) {
          log.error("String_Node_Str" + network.getInputCount() + "String_Node_Str"+ pair.getInput().size());
          continue;
        }
        MLData score=network.compute(pair.getInput());
        if (modelConfig != null && modelConfig.isBinaryClassification()) {
          scores.add(toScore(score.getData(0)));
        }
 else {
          double[] outputs=score.getData();
          for (          double d : outputs) {
            scores.add(toScore(d));
          }
        }
      }
 else       if (model instanceof SVM) {
        SVM svm=(SVM)model;
        if (svm.getInputCount() != pair.getInput().size()) {
          log.error("String_Node_Str" + svm.getInputCount() + "String_Node_Str"+ pair.getInput().size());
          continue;
        }
        MLData score=svm.compute(pair.getInput());
        scores.add(toScore(score.getData(0)));
      }
 else       if (model instanceof LR) {
        LR lr=(LR)model;
        if (lr.getInputCount() != pair.getInput().size()) {
          log.error("String_Node_Str" + lr.getInputCount() + "String_Node_Str"+ pair.getInput().size());
          continue;
        }
        MLData score=lr.compute(pair.getInput());
        scores.add(toScore(score.getData(0)));
      }
 else       if (model instanceof TreeModel) {
        TreeModel rf=(TreeModel)model;
        if (rf.getInputCount() != pair.getInput().size()) {
          log.error("String_Node_Str" + rf.getInputCount() + "String_Node_Str"+ pair.getInput().size());
          continue;
        }
        MLData score=rf.compute(pair.getInput());
        scores.add(toScore(score.getData(0)));
      }
 else {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
  Integer tag=(int)pair.getIdeal().getData(0);
  if (scores.size() == 0) {
    log.error("String_Node_Str");
    return null;
  }
  return new ScoreObject(scores,tag);
}

Fixed version (ground truth):
public ScoreObject score(MLDataPair pair,Map<String,String> rawDataMap){
  if (pair == null) {
    return null;
  }
  List<Integer> scores=new ArrayList<Integer>();
  for (  BasicML model : models) {
    if (model instanceof BasicNetwork) {
      BasicNetwork network=(BasicNetwork)model;
      if (network.getInputCount() != pair.getInput().size()) {
        log.error("String_Node_Str" + network.getInputCount() + "String_Node_Str"+ pair.getInput().size());
        continue;
      }
      MLData score=network.compute(pair.getInput());
      if (modelConfig != null && modelConfig.isBinaryClassification()) {
        scores.add(toScore(score.getData(0)));
      }
 else {
        double[] outputs=score.getData();
        for (        double d : outputs) {
          scores.add(toScore(d));
        }
      }
    }
 else     if (model instanceof SVM) {
      SVM svm=(SVM)model;
      if (svm.getInputCount() != pair.getInput().size()) {
        log.error("String_Node_Str" + svm.getInputCount() + "String_Node_Str"+ pair.getInput().size());
        continue;
      }
      MLData score=svm.compute(pair.getInput());
      scores.add(toScore(score.getData(0)));
    }
 else     if (model instanceof LR) {
      LR lr=(LR)model;
      if (lr.getInputCount() != pair.getInput().size()) {
        log.error("String_Node_Str" + lr.getInputCount() + "String_Node_Str"+ pair.getInput().size());
        continue;
      }
      MLData score=lr.compute(pair.getInput());
      scores.add(toScore(score.getData(0)));
    }
 else     if (model instanceof TreeModel) {
      TreeModel rf=(TreeModel)model;
      if (rf.getInputCount() != pair.getInput().size()) {
        throw new RuntimeException("String_Node_Str" + rf.getInputCount() + "String_Node_Str"+ pair.getInput().size());
      }
      MLData score=rf.compute(pair.getInput());
      scores.add(toScore(score.getData(0)));
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
  Integer tag=(int)pair.getIdeal().getData(0);
  if (scores.size() == 0) {
    log.error("String_Node_Str");
    return null;
  }
  return new ScoreObject(scores,tag);
}