Program: 33068
Project: 33068
Buggy source:
static Optional<SplitResult> split(RegTreeConfig regTreeConfig,DataSet dataSet,double[] labels,double[] probs,int featureIndex){
  int numDataPoints=dataSet.getNumDataPoints();
  Vector featureValues;
  Vector inputVector=dataSet.getFeatureColumn(featureIndex).getVector();
  if (inputVector.isDense()) {
    featureValues=inputVector;
  }
 else {
    featureValues=new DenseVector(inputVector);
  }
  double parentSSE=ProbabilisticSSE.sse(labels,probs);
  double leftCountExisting=0;
  double rightCountExisting=0;
  for (int i=0; i < numDataPoints; i++) {
    double featureValue=featureValues.get(i);
    if (featureValue == 0) {
      leftCountExisting+=probs[i];
    }
    if (featureValue == 1) {
      rightCountExisting+=probs[i];
    }
  }
  double sumOfCounts=leftCountExisting + rightCountExisting;
  if (sumOfCounts == 0) {
    return Optional.empty();
  }
  double leftPriorProb=leftCountExisting / sumOfCounts;
  double rightPriorProb=rightCountExisting / sumOfCounts;
  double[] leftProbs=new double[numDataPoints];
  double[] rightProbs=new double[numDataPoints];
  for (int i=0; i < numDataPoints; i++) {
    double label=labels[i];
    if (Double.isNaN(label)) {
      leftProbs[i]=probs[i] * leftPriorProb;
      rightProbs[i]=probs[i] * rightPriorProb;
    }
    if (label == 0) {
      leftProbs[i]=probs[i];
      rightProbs[i]=0;
    }
    if (label == 1) {
      leftProbs[i]=0;
      rightProbs[i]=probs[i];
    }
  }
  double totalLeftCount=MathUtil.arraySum(leftProbs);
  double totalRightCount=MathUtil.arraySum(rightProbs);
  int minDataPerLeaf=regTreeConfig.getMinDataPerLeaf();
  boolean valid=(totalLeftCount >= minDataPerLeaf) && (totalRightCount >= minDataPerLeaf);
  if (!valid) {
    return Optional.empty();
  }
  double leftSSE=ProbabilisticSSE.sse(labels,leftProbs);
  double rightSSE=ProbabilisticSSE.sse(labels,rightProbs);
  double reduction=parentSSE - leftSSE - rightSSE;
  SplitResult splitResult=new SplitResult();
  splitResult.setFeatureIndex(featureIndex).setThreshold(0).setReduction(reduction).setLeftCount(totalLeftCount).setRightCount(totalRightCount);
  return Optional.of(splitResult);
}

Fixed version (ground truth):
static Optional<SplitResult> split(RegTreeConfig regTreeConfig,DataSet dataSet,double[] labels,double[] probs,int featureIndex){
  int numDataPoints=dataSet.getNumDataPoints();
  Vector featureValues;
  Vector inputVector=dataSet.getFeatureColumn(featureIndex).getVector();
  if (inputVector.isDense()) {
    featureValues=inputVector;
  }
 else {
    featureValues=new DenseVector(inputVector);
  }
  System.out.println(featureValues);
  double parentSSE=ProbabilisticSSE.sse(labels,probs);
  double leftCountExisting=0;
  double rightCountExisting=0;
  for (int i=0; i < numDataPoints; i++) {
    double featureValue=featureValues.get(i);
    if (featureValue == 0) {
      leftCountExisting+=probs[i];
    }
    if (featureValue == 1) {
      rightCountExisting+=probs[i];
    }
  }
  double sumOfCounts=leftCountExisting + rightCountExisting;
  if (sumOfCounts == 0) {
    return Optional.empty();
  }
  double leftPriorProb=leftCountExisting / sumOfCounts;
  double rightPriorProb=rightCountExisting / sumOfCounts;
  double[] leftProbs=new double[numDataPoints];
  double[] rightProbs=new double[numDataPoints];
  for (int i=0; i < numDataPoints; i++) {
    double featureValue=featureValues.get(i);
    if (Double.isNaN(featureValue)) {
      leftProbs[i]=probs[i] * leftPriorProb;
      rightProbs[i]=probs[i] * rightPriorProb;
    }
    if (featureValue == 0) {
      leftProbs[i]=probs[i];
      rightProbs[i]=0;
    }
    if (featureValue == 1) {
      leftProbs[i]=0;
      rightProbs[i]=probs[i];
    }
  }
  System.out.println("String_Node_Str");
  System.out.println(Arrays.toString(leftProbs));
  System.out.println("String_Node_Str");
  System.out.println(Arrays.toString(rightProbs));
  double totalLeftCount=MathUtil.arraySum(leftProbs);
  double totalRightCount=MathUtil.arraySum(rightProbs);
  int minDataPerLeaf=regTreeConfig.getMinDataPerLeaf();
  boolean valid=(totalLeftCount >= minDataPerLeaf) && (totalRightCount >= minDataPerLeaf);
  if (!valid) {
    return Optional.empty();
  }
  double leftSSE=ProbabilisticSSE.sse(labels,leftProbs);
  double rightSSE=ProbabilisticSSE.sse(labels,rightProbs);
  double reduction=parentSSE - leftSSE - rightSSE;
  SplitResult splitResult=new SplitResult();
  splitResult.setFeatureIndex(featureIndex).setThreshold(0).setReduction(reduction).setLeftCount(totalLeftCount).setRightCount(totalRightCount);
  return Optional.of(splitResult);
}