nus-yam/ex-repair huggingface dataset:
Program: 32936
Project: 32936
Buggy source:
public void iterate(){
  double[][] probs=new double[dataSet.getNumDataPoints()][numClasses];
  double[][] classScores=new double[dataSet.getNumDataPoints()][numClasses];
  IntStream.range(0,dataSet.getNumDataPoints()).parallel().forEach(i -> {
    probs[i]=logisticRegression.predictClassProbs(dataSet.getRow(i));
    classScores[i]=logisticRegression.predictClassScores(dataSet.getRow(i));
  }
);
  IntStream.range(0,numClasses).parallel().forEach(i -> optimizeOneClass(i,probs,classScores));
  if (lineSearch) {
    Weights oldWeights=logisticRegression.getWeights().deepCopy();
    Weights newWeights=logisticRegression.getWeights().deepCopy();
    Vector searchDirection=newWeights.getAllWeights().minus(oldWeights.getAllWeights());
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + searchDirection.norm(2));
    }
    logisticRegression.getWeights().setWeightVector(oldWeights.getAllWeights());
    Vector gradient=this.predictedCounts.minus(empiricalCounts).divide(dataSet.getNumDataPoints());
    lineSearch(searchDirection,gradient);
    updateClassProbMatrix();
    updatePredictedCounts();
  }
  terminator.add(getLoss());
}

Fixed version (ground truth):
public void iterate(){
  double[][] probs=new double[dataSet.getNumDataPoints()][numClasses];
  double[][] classScores=new double[dataSet.getNumDataPoints()][numClasses];
  IntStream.range(0,dataSet.getNumDataPoints()).parallel().forEach(i -> {
    probs[i]=logisticRegression.predictClassProbs(dataSet.getRow(i));
    classScores[i]=logisticRegression.predictClassScores(dataSet.getRow(i));
  }
);
  Weights oldWeights=logisticRegression.getWeights().deepCopy();
  IntStream.range(0,numClasses).parallel().forEach(i -> optimizeOneClass(i,probs,classScores));
  if (lineSearch) {
    Weights newWeights=logisticRegression.getWeights().deepCopy();
    Vector searchDirection=newWeights.getAllWeights().minus(oldWeights.getAllWeights());
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + searchDirection.norm(2));
    }
    logisticRegression.getWeights().setWeightVector(oldWeights.getAllWeights());
    Vector gradient=this.predictedCounts.minus(empiricalCounts).divide(dataSet.getNumDataPoints());
    lineSearch(searchDirection,gradient);
    updateClassProbMatrix();
    updatePredictedCounts();
  }
  terminator.add(getLoss());
}
Program: 32937
Project: 32937
Buggy source:
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return getWeights().toString();
}
Program: 32938
Project: 32938
Buggy source:
/** 
 * @return negative log-likelihood
 */
@Override public double getValue(){
  if (isValueCacheValid) {
    return this.value;
  }
  double weightSquare=0.0;
  for (int k=0; k < numClasses; k++) {
    Vector weightVector=cmlcrf.getWeights().getWeightsWithoutBiasForClass(k);
    weightSquare+=weightVector.dot(weightVector);
  }
  if (regularizeAll) {
    for (int k=0; k < numClasses; k++) {
      double bias=cmlcrf.getWeights().getBiasForClass(k);
      weightSquare+=bias * bias;
    }
    Vector labelPairVector=cmlcrf.getWeights().getAllLabelPairWeights();
    weightSquare+=labelPairVector.dot(labelPairVector);
  }
  this.value=getValueForAllData() + weightSquare / 2 * gaussianPriorVariance;
  this.isValueCacheValid=true;
  return this.value;
}

Fixed version (ground truth):
/** 
 * @return negative log-likelihood
 */
@Override public double getValue(){
  if (isValueCacheValid) {
    return this.value;
  }
  double weightSquare=0.0;
  for (int k=0; k < numClasses; k++) {
    Vector weightVector=cmlcrf.getWeights().getWeightsWithoutBiasForClass(k);
    weightSquare+=weightVector.dot(weightVector);
  }
  if (regularizeAll) {
    for (int k=0; k < numClasses; k++) {
      double bias=cmlcrf.getWeights().getBiasForClass(k);
      weightSquare+=bias * bias;
    }
    Vector labelPairVector=cmlcrf.getWeights().getAllLabelPairWeights();
    weightSquare+=labelPairVector.dot(labelPairVector);
  }
  this.value=getValueForAllData() + weightSquare / (2 * gaussianPriorVariance);
  this.isValueCacheValid=true;
  return this.value;
}
Program: 32939
Project: 32939
Buggy source:
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  for (int k=0; k < numClasses; k++) {
    sb.append("String_Node_Str").append(k).append("String_Node_Str").append("String_Node_Str");
    sb.append("String_Node_Str" + getBiasForClass(k)).append("String_Node_Str");
    sb.append("String_Node_Str" + getWeightsWithoutBiasForClass(k)).append("String_Node_Str");
  }
  int start=numWeightsForFeatures;
  for (int l1=0; l1 < numClasses; l1++) {
    for (int l2=l1 + 1; l2 < numClasses; l2++) {
      sb.append("String_Node_Str" + l1 + "String_Node_Str"+ l2+ "String_Node_Str");
      sb.append("String_Node_Str" + weightVector.get(start) + "String_Node_Str"+ weightVector.get(start + 1)+ "String_Node_Str"+ weightVector.get(start + 2)+ "String_Node_Str"+ weightVector.get(start + 3));
      start+=4;
    }
  }
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  for (int k=0; k < numClasses; k++) {
    sb.append("String_Node_Str").append(k).append("String_Node_Str").append("String_Node_Str");
    sb.append("String_Node_Str" + getBiasForClass(k)).append("String_Node_Str");
    sb.append("String_Node_Str" + getWeightsWithoutBiasForClass(k)).append("String_Node_Str");
  }
  int start=numWeightsForFeatures;
  for (int l1=0; l1 < numClasses; l1++) {
    for (int l2=l1 + 1; l2 < numClasses; l2++) {
      sb.append("String_Node_Str" + l1 + "String_Node_Str"+ l2+ "String_Node_Str");
      sb.append("String_Node_Str" + weightVector.get(start) + "String_Node_Str"+ weightVector.get(start + 1)+ "String_Node_Str"+ weightVector.get(start + 2)+ "String_Node_Str"+ weightVector.get(start + 3));
      sb.append("String_Node_Str");
      start+=4;
    }
  }
  sb.append('}');
  return sb.toString();
}
Program: 32940
Project: 32940
Buggy source:
public static void main(String[] args) throws Exception {
  test1();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  test7();
}
Program: 32941
Project: 32941
Buggy source:
public void iterate(){
  updateTargets();
  updateBinaryTargets();
  updateGamma();
  updateMultiClassClassifier();
  updateBinaryClassifiers();
  this.terminator.add(objective());
}

Fixed version (ground truth):
public void iterate(){
  updateTargets();
  updateBinaryTargets();
  updateGamma();
  updateMultiClassClassifier();
  updateBinaryClassifiers();
  updateProbabilities();
  this.terminator.add(objective());
}
Program: 32942
Project: 32942
Buggy source:
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append('}');
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return getWeights().toString();
}
Program: 32943
Project: 32943
Buggy source:
/** 
 * @return negative log-likelihood
 */
@Override public double getValue(){
  if (isValueCacheValid) {
    return this.value;
  }
  double weightSquare=0.0;
  for (int k=0; k < numClasses; k++) {
    Vector weightVector=cmlcrf.getWeights().getWeightsWithoutBiasForClass(k);
    weightSquare+=weightVector.dot(weightVector);
  }
  if (regularizeAll) {
    for (int k=0; k < numClasses; k++) {
      double bias=cmlcrf.getWeights().getBiasForClass(k);
      weightSquare+=bias * bias;
    }
    Vector labelPairVector=cmlcrf.getWeights().getAllLabelPairWeights();
    weightSquare+=labelPairVector.dot(labelPairVector);
  }
  this.value=getValueForAllData() + weightSquare / 2 * gaussianPriorVariance;
  this.isValueCacheValid=true;
  return this.value;
}

Fixed version (ground truth):
/** 
 * @return negative log-likelihood
 */
@Override public double getValue(){
  if (isValueCacheValid) {
    return this.value;
  }
  double weightSquare=0.0;
  for (int k=0; k < numClasses; k++) {
    Vector weightVector=cmlcrf.getWeights().getWeightsWithoutBiasForClass(k);
    weightSquare+=weightVector.dot(weightVector);
  }
  if (regularizeAll) {
    for (int k=0; k < numClasses; k++) {
      double bias=cmlcrf.getWeights().getBiasForClass(k);
      weightSquare+=bias * bias;
    }
    Vector labelPairVector=cmlcrf.getWeights().getAllLabelPairWeights();
    weightSquare+=labelPairVector.dot(labelPairVector);
  }
  this.value=getValueForAllData() + weightSquare / (2 * gaussianPriorVariance);
  this.isValueCacheValid=true;
  return this.value;
}
Program: 32944
Project: 32944
Buggy source:
@Override protected void addPriors(){
  PriorProbClassifier priorProbClassifier=new PriorProbClassifier(numClasses);
  priorProbClassifier.fit(dataSet,targetDistribution,weights);
  double[] probs=priorProbClassifier.getClassProbs();
  double average=Arrays.stream(probs).map(Math::log).average().getAsDouble();
  for (int k=0; k < numClasses; k++) {
    double score=Math.log(probs[k] - average);
    Regressor constant=new ConstantRegressor(score);
    boosting.getEnsemble(k).add(constant);
  }
}

Fixed version (ground truth):
@Override protected void addPriors(){
  PriorProbClassifier priorProbClassifier=new PriorProbClassifier(numClasses);
  priorProbClassifier.fit(dataSet,targetDistribution,weights);
  double[] probs=priorProbClassifier.getClassProbs();
  double[] scores=MathUtil.inverseSoftMax(probs);
  for (int i=0; i < scores.length; i++) {
    if (scores[i] > 5) {
      scores[i]=5;
    }
    if (scores[i] < -5) {
      scores[i]=-5;
    }
  }
  for (int k=0; k < numClasses; k++) {
    Regressor constant=new ConstantRegressor(scores[k]);
    boosting.getEnsemble(k).add(constant);
  }
}
Program: 32945
Project: 32945
Buggy source:
BMDistribution(CBM cbm,Vector x){
  this.numLabels=cbm.numLabels;
  this.numComponents=cbm.numComponents;
  this.logProportions=cbm.multiClassClassifier.predictLogClassProbs(x);
  this.logClassProbs=new double[numComponents][numLabels];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      logClassProbs[k][l]=cbm.binaryClassifiers[k][l].predictLogClassProbs(x)[1];
    }
  }
}

Fixed version (ground truth):
BMDistribution(CBM cbm,Vector x){
  this.numLabels=cbm.numLabels;
  this.numComponents=cbm.numComponents;
  this.logProportions=cbm.multiClassClassifier.predictLogClassProbs(x);
  this.logClassProbs=new double[numComponents][numLabels][2];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      logClassProbs[k][l]=cbm.binaryClassifiers[k][l].predictLogClassProbs(x);
    }
  }
}
Program: 32946
Project: 32946
Buggy source:
private double marginal(int labelIndex){
  double sum=0;
  for (int k=0; k < numComponents; k++) {
    sum+=Math.exp(logProportions[k]) * Math.exp(logClassProbs[k][labelIndex]);
  }
  return sum;
}

Fixed version (ground truth):
private double marginal(int labelIndex){
  double sum=0;
  for (int k=0; k < numComponents; k++) {
    sum+=Math.exp(logProportions[k]) * Math.exp(logClassProbs[k][labelIndex][1]);
  }
  return sum;
}
Program: 32947
Project: 32947
Buggy source:
private double logYGivenComponent(MultiLabel y,int k){
  double sum=0.0;
  for (int l=0; l < numLabels; l++) {
    if (y.matchClass(l)) {
      sum+=logClassProbs[k][l];
    }
 else {
      sum+=1 - logClassProbs[k][l];
    }
  }
  return sum;
}

Fixed version (ground truth):
private double logYGivenComponent(MultiLabel y,int k){
  double sum=0.0;
  for (int l=0; l < numLabels; l++) {
    if (y.matchClass(l)) {
      sum+=logClassProbs[k][l][1];
    }
 else {
      sum+=logClassProbs[k][l][0];
    }
  }
  return sum;
}
Program: 32948
Project: 32948
Buggy source:
List<MultiLabel> sample(int numSamples){
  List<MultiLabel> list=new ArrayList<>();
  double[] proportions=Arrays.stream(logProportions).map(Math::exp).toArray();
  double[][] classProbs=new double[numComponents][numLabels];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      classProbs[k][l]=Math.exp(logClassProbs[k][l]);
    }
  }
  int[] components=IntStream.range(0,numComponents).toArray();
  EnumeratedIntegerDistribution enumeratedIntegerDistribution=new EnumeratedIntegerDistribution(components,proportions);
  BernoulliDistribution[][] bernoulliDistributions=new BernoulliDistribution[numComponents][numLabels];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      bernoulliDistributions[k][l]=new BernoulliDistribution(classProbs[k][l]);
    }
  }
  for (int num=0; num < numSamples; num++) {
    MultiLabel multiLabel=new MultiLabel();
    int k=enumeratedIntegerDistribution.sample();
    for (int l=0; l < numLabels; l++) {
      int v=bernoulliDistributions[k][l].sample();
      if (v == 1) {
        multiLabel.addLabel(l);
      }
    }
    list.add(multiLabel);
  }
  return list;
}

Fixed version (ground truth):
List<MultiLabel> sample(int numSamples){
  List<MultiLabel> list=new ArrayList<>();
  double[] proportions=Arrays.stream(logProportions).map(Math::exp).toArray();
  double[][] classProbs=new double[numComponents][numLabels];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      classProbs[k][l]=Math.exp(logClassProbs[k][l][1]);
    }
  }
  int[] components=IntStream.range(0,numComponents).toArray();
  EnumeratedIntegerDistribution enumeratedIntegerDistribution=new EnumeratedIntegerDistribution(components,proportions);
  BernoulliDistribution[][] bernoulliDistributions=new BernoulliDistribution[numComponents][numLabels];
  for (int k=0; k < numComponents; k++) {
    for (int l=0; l < numLabels; l++) {
      bernoulliDistributions[k][l]=new BernoulliDistribution(classProbs[k][l]);
    }
  }
  for (int num=0; num < numSamples; num++) {
    MultiLabel multiLabel=new MultiLabel();
    int k=enumeratedIntegerDistribution.sample();
    for (int l=0; l < numLabels; l++) {
      int v=bernoulliDistributions[k][l].sample();
      if (v == 1) {
        multiLabel.addLabel(l);
      }
    }
    list.add(multiLabel);
  }
  return list;
}
Program: 32949
Project: 32949
Buggy source:
private void updateBinaryLogisticRegression(int clusterIndex,int labelIndex){
  RidgeLogisticOptimizer ridgeLogisticOptimizer;
  ridgeLogisticOptimizer=new RidgeLogisticOptimizer((LogisticRegression)cbm.binaryClassifiers[clusterIndex][labelIndex],dataSet,gammasT[clusterIndex],targetsDistributions[labelIndex],priorVarianceBinary,false);
  ridgeLogisticOptimizer.getOptimizer().getTerminator().setMaxIteration(10);
  ridgeLogisticOptimizer.optimize();
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + clusterIndex + "String_Node_Str"+ labelIndex+ "String_Node_Str"+ ridgeLogisticOptimizer.getOptimizer().getTerminator().getHistory());
  }
}

Fixed version (ground truth):
private void updateBinaryLogisticRegression(int clusterIndex,int labelIndex){
  RidgeLogisticOptimizer ridgeLogisticOptimizer;
  ridgeLogisticOptimizer=new RidgeLogisticOptimizer((LogisticRegression)cbm.binaryClassifiers[clusterIndex][labelIndex],dataSet,gammasT[clusterIndex],targetsDistributions[labelIndex],priorVarianceBinary,false);
  ridgeLogisticOptimizer.getOptimizer().getTerminator().setMaxIteration(10);
  ridgeLogisticOptimizer.optimize();
}
Program: 32950
Project: 32950
Buggy source:
public void add(double value){
  if (Double.isInfinite(value) && !allowInfinite) {
    throw new RuntimeException("String_Node_Str");
  }
  if (Double.isNaN(value) && !allowNaN) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!isMoveValid(value)) {
    if (logger.isWarnEnabled()) {
      logger.warn("String_Node_Str" + goal + "String_Node_Str"+ min+ "String_Node_Str"+ max+ "String_Node_Str"+ value);
    }
  }
  this.history.add(value);
  if (value > max) {
    max=value;
  }
  if (value < min) {
    min=value;
  }
  if (history.size() >= 2) {
    double previous=history.get(history.size() - 2);
    boolean condition1=Math.abs((value - previous) / previous) <= relativeEpsilon;
    boolean condition2=Math.abs(value - previous) <= absoluteEpsilon;
    if (condition1 && condition2) {
      stableCounter+=1;
    }
 else {
      stableCounter=0;
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + history.size());
    logger.debug("String_Node_Str" + getMode());
    logger.debug("String_Node_Str" + getGoal());
    logger.debug("String_Node_Str" + getLastValue());
    logger.debug("String_Node_Str" + getPreviousValue());
    logger.debug("String_Node_Str" + getMinValue());
    logger.debug("String_Node_Str" + getMaxValue());
    logger.debug("String_Node_Str" + getStableIterations());
    logger.debug("String_Node_Str" + isConverged());
    logger.debug("String_Node_Str" + shouldTerminate());
  }
}

Fixed version (ground truth):
public void add(double value){
  if (Double.isInfinite(value) && !allowInfinite) {
    throw new RuntimeException("String_Node_Str");
  }
  if (Double.isNaN(value) && !allowNaN) {
    throw new RuntimeException("String_Node_Str");
  }
  if (!isMoveValid(value)) {
    if (logger.isWarnEnabled()) {
      logger.warn("String_Node_Str" + goal + "String_Node_Str"+ min+ "String_Node_Str"+ max+ "String_Node_Str"+ value);
    }
  }
  this.history.add(value);
  if (value > max) {
    max=value;
  }
  if (value < min) {
    min=value;
  }
  if (history.size() >= 2) {
    double previous=history.get(history.size() - 2);
    boolean condition1=Math.abs(value - previous) <= relativeEpsilon * Math.abs(previous);
    boolean condition2=Math.abs(value - previous) <= absoluteEpsilon;
    if (condition1 && condition2) {
      stableCounter+=1;
    }
 else {
      stableCounter=0;
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + history.size());
    logger.debug("String_Node_Str" + getMode());
    logger.debug("String_Node_Str" + getGoal());
    logger.debug("String_Node_Str" + getLastValue());
    logger.debug("String_Node_Str" + getPreviousValue());
    logger.debug("String_Node_Str" + getMinValue());
    logger.debug("String_Node_Str" + getMaxValue());
    logger.debug("String_Node_Str" + getStableIterations());
    logger.debug("String_Node_Str" + isConverged());
    logger.debug("String_Node_Str" + shouldTerminate());
  }
}
Program: 32951
Project: 32951
Buggy source:
public static void main(String[] args){
  LoggerContext ctx=(LoggerContext)LogManager.getContext(false);
  Configuration config=ctx.getConfiguration();
  LoggerConfig loggerConfig=config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
  loggerConfig.setLevel(Level.DEBUG);
  ctx.updateLoggers();
  test2();
}

Fixed version (ground truth):
public static void main(String[] args){
  test4();
}
Program: 32952
Project: 32952
Buggy source:
/** 
 * a special back track line search for sufficient decrease with elasticnet penalized model reference: An improved glmnet for l1-regularized logistic regression.
 * @param searchDirection
 * @return
 */
private void lineSearch(Vector searchDirection,Vector gradient){
  Vector localSearchDir;
  double initialStepLength=1;
  double shrinkage=0.5;
  double c=1e-4;
  double stepLength=initialStepLength;
  Vector start=logisticRegression.getWeights().getAllWeights();
  double penalty=penalty();
  double value=loss(penalty);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + loss());
  }
  double product=gradient.dot(searchDirection);
  if (product < 0) {
    localSearchDir=searchDirection;
  }
 else {
    if (logger.isWarnEnabled()) {
      logger.warn("String_Node_Str" + product);
    }
    localSearchDir=gradient.times(-1);
  }
  while (true) {
    Vector step=localSearchDir.times(stepLength);
    Vector target=start.plus(step);
    logisticRegression.getWeights().setWeightVector(target);
    double targetPenalty=penalty();
    double targetValue=loss(targetPenalty);
    if (targetValue <= value + c * stepLength * (product + targetPenalty - penalty)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + stepLength);
        logger.debug("String_Node_Str" + targetValue);
        logger.debug("String_Node_Str");
      }
      break;
    }
    stepLength*=shrinkage;
  }
}

Fixed version (ground truth):
/** 
 * a special back track line search for sufficient decrease with elasticnet penalized model reference: An improved glmnet for l1-regularized logistic regression.
 * @param searchDirection
 * @return
 */
private void lineSearch(Vector searchDirection,Vector gradient){
  Vector localSearchDir;
  double initialStepLength=1;
  double shrinkage=0.5;
  double c=1e-4;
  double stepLength=initialStepLength;
  Vector start=logisticRegression.getWeights().getAllWeights();
  double penalty=penalty();
  double value=loss(penalty);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
    logger.debug("String_Node_Str" + loss());
  }
  double product=gradient.dot(searchDirection);
  localSearchDir=searchDirection;
  while (true) {
    Vector step=localSearchDir.times(stepLength);
    Vector target=start.plus(step);
    logisticRegression.getWeights().setWeightVector(target);
    double targetPenalty=penalty();
    double targetValue=loss(targetPenalty);
    if (targetValue <= value + c * stepLength * (product + targetPenalty - penalty)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + stepLength);
        logger.debug("String_Node_Str" + targetValue);
        logger.debug("String_Node_Str");
      }
      break;
    }
    stepLength*=shrinkage;
  }
}
Program: 32954
Project: 32954
Buggy source:
private void updateBinaryLogisticRegressionEL(int clusterIndex,int labelIndex){
  ElasticNetLogisticTrainer elasticNetLogisticTrainer=new ElasticNetLogisticTrainer.Builder((LogisticRegression)CBM.binaryClassifiers[clusterIndex][labelIndex],dataSet,2,targetsDistributions[labelIndex]).setRegularization(regularizationBinary).setL1Ratio(l1RatioBinary).setLineSearch(lineSearch).build();
  elasticNetLogisticTrainer.optimize();
}

Fixed version (ground truth):
private void updateBinaryLogisticRegressionEL(int clusterIndex,int labelIndex){
  ElasticNetLogisticTrainer elasticNetLogisticTrainer=new ElasticNetLogisticTrainer.Builder((LogisticRegression)CBM.binaryClassifiers[clusterIndex][labelIndex],dataSet,2,targetsDistributions[labelIndex]).setRegularization(regularizationBinary).setL1Ratio(l1RatioBinary).setLineSearch(lineSearch).build();
  elasticNetLogisticTrainer.getTerminator().setMaxIteration(10);
  elasticNetLogisticTrainer.optimize();
}
Program: 32955
Project: 32955
Buggy source:
private double binaryObj(int clusterIndex,int classIndex){
  String type=CBM.getBinaryClassifierType();
switch (type) {
case "String_Node_Str":
    return binaryLRObj(clusterIndex,classIndex);
case "String_Node_Str":
  return binaryBoostObj(clusterIndex,classIndex);
default :
throw new IllegalArgumentException("String_Node_Str");
}
}

Fixed version (ground truth):
private double binaryObj(int clusterIndex,int classIndex){
  String type=CBM.getBinaryClassifierType();
switch (type) {
case "String_Node_Str":
    return binaryLRObj(clusterIndex,classIndex);
case "String_Node_Str":
  return binaryBoostObj(clusterIndex,classIndex);
case "String_Node_Str":
return binaryLRObj(clusterIndex,classIndex);
default :
throw new IllegalArgumentException("String_Node_Str" + type);
}
}
Program: 32956
Project: 32956
Buggy source:
private void updateMultiClassEL(){
  ElasticNetLogisticTrainer elasticNetLogisticTrainer=new ElasticNetLogisticTrainer.Builder((LogisticRegression)CBM.multiClassClassifier,dataSet,CBM.multiClassClassifier.getNumClasses(),gammas).setRegularization(regularizationMultiClass).setL1Ratio(l1RatioMultiClass).setLineSearch(lineSearch).build();
  elasticNetLogisticTrainer.optimize();
}

Fixed version (ground truth):
private void updateMultiClassEL(){
  ElasticNetLogisticTrainer elasticNetLogisticTrainer=new ElasticNetLogisticTrainer.Builder((LogisticRegression)CBM.multiClassClassifier,dataSet,CBM.multiClassClassifier.getNumClasses(),gammas).setRegularization(regularizationMultiClass).setL1Ratio(l1RatioMultiClass).setLineSearch(lineSearch).build();
  elasticNetLogisticTrainer.getTerminator().setMaxIteration(10);
  elasticNetLogisticTrainer.optimize();
}
Program: 32957
Project: 32957
Buggy source:
private void updateMultiClassClassifier(){
  String type=CBM.getMultiClassClassifierType();
switch (type) {
case "String_Node_Str":
    updateMultiClassLR();
  break;
case "String_Node_Str":
updateMultiClassBoost();
break;
case "String_Node_Str":
updateMultiClassEL();
default :
throw new IllegalArgumentException("String_Node_Str");
}
}

Fixed version (ground truth):
private void updateMultiClassClassifier(){
  String type=CBM.getMultiClassClassifierType();
switch (type) {
case "String_Node_Str":
    updateMultiClassLR();
  break;
case "String_Node_Str":
updateMultiClassBoost();
break;
case "String_Node_Str":
updateMultiClassEL();
break;
default :
throw new IllegalArgumentException("String_Node_Str" + CBM.getMultiClassClassifierType());
}
}
Program: 32958
Project: 32958
Buggy source:
private double multiClassClassifierObj(){
  String type=CBM.getMultiClassClassifierType();
switch (type) {
case "String_Node_Str":
    return multiClassLRObj();
case "String_Node_Str":
  return multiClassBoostObj();
default :
throw new IllegalArgumentException("String_Node_Str");
}
}

Fixed version (ground truth):
private double multiClassClassifierObj(){
  String type=CBM.getMultiClassClassifierType();
switch (type) {
case "String_Node_Str":
    return multiClassLRObj();
case "String_Node_Str":
  return multiClassBoostObj();
case "String_Node_Str":
return multiClassLRObj();
default :
throw new IllegalArgumentException("String_Node_Str" + type);
}
}
Program: 32959
Project: 32959
Buggy source:
private void updateBinaryClassifiers(int clusterIndex){
  String type=CBM.getBinaryClassifierType();
switch (type) {
case "String_Node_Str":
    IntStream.range(0,CBM.numLabels).parallel().forEach(l -> updateBinaryLogisticRegression(clusterIndex,l));
  break;
case "String_Node_Str":
IntStream.range(0,CBM.numLabels).forEach(l -> updateBinaryBoosting(clusterIndex,l));
break;
case "String_Node_Str":
IntStream.range(0,CBM.numLabels).parallel().forEach(l -> updateBinaryLogisticRegressionEL(clusterIndex,l));
default :
throw new IllegalArgumentException("String_Node_Str");
}
}

Fixed version (ground truth):
private void updateBinaryClassifiers(int clusterIndex){
  String type=CBM.getBinaryClassifierType();
switch (type) {
case "String_Node_Str":
    IntStream.range(0,CBM.numLabels).parallel().forEach(l -> updateBinaryLogisticRegression(clusterIndex,l));
  break;
case "String_Node_Str":
IntStream.range(0,CBM.numLabels).forEach(l -> updateBinaryBoosting(clusterIndex,l));
break;
case "String_Node_Str":
IntStream.range(0,CBM.numLabels).parallel().forEach(l -> updateBinaryLogisticRegressionEL(clusterIndex,l));
break;
default :
throw new IllegalArgumentException("String_Node_Str" + CBM.getBinaryClassifierType());
}
}
Program: 32960
Project: 32960
Buggy source:
public static Pair<BMMClassifier,Integer> loadOldBMM(Config config) throws Exception {
  BMMClassifier bmmClassifier;
  int completedIterations=0;
  String output=config.getString("String_Node_Str");
  String modelName=config.getString("String_Node_Str");
  File folder=Paths.get(output,modelName).toFile();
  File[] modeFiles=folder.listFiles((dir,name) -> name.startsWith("String_Node_Str") && (name.endsWith("String_Node_Str")));
  File lastFile=null;
  int lastIter=-1;
  for (  File file : modeFiles) {
    String[] split=file.getName().split(Pattern.quote("String_Node_Str"));
    int iter=Integer.parseInt(split[1]);
    if (iter > lastIter) {
      lastIter=iter;
      lastFile=file;
      completedIterations=lastIter;
    }
  }
  bmmClassifier=BMMClassifier.deserialize(lastFile);
  System.out.println("String_Node_Str" + completedIterations + "String_Node_Str");
  return new Pair<>(bmmClassifier,completedIterations);
}

Fixed version (ground truth):
public static Pair<BMMClassifier,Integer> loadOldBMM(Config config) throws Exception {
  BMMClassifier bmmClassifier;
  int completedIterations=0;
  String output=config.getString("String_Node_Str");
  String modelName=config.getString("String_Node_Str");
  File folder=Paths.get(output,modelName).toFile();
  File[] modeFiles=folder.listFiles((dir,name) -> name.startsWith("String_Node_Str") && (name.endsWith("String_Node_Str")));
  File lastFile=null;
  int lastIter=-1;
  for (  File file : modeFiles) {
    String[] split=file.getName().split(Pattern.quote("String_Node_Str"));
    int iter=Integer.parseInt(split[1]);
    if (iter > lastIter) {
      lastIter=iter;
      lastFile=file;
      completedIterations=lastIter;
    }
  }
  bmmClassifier=BMMClassifier.deserialize(lastFile);
  System.out.println("String_Node_Str" + completedIterations + "String_Node_Str");
  bmmClassifier.setPredictMode(config.getString("String_Node_Str"));
  return new Pair<>(bmmClassifier,completedIterations);
}
Program: 32962
Project: 32962
Buggy source:
/** 
 * calculate the current the highest probability of the first element in the queue.
 * @return
 */
public double nextHighestProb(){
  if (dp.size() > 0) {
    return Math.exp(dp.peek().logProbability);
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * calculate the current the highest probability of the first element in the queue.
 * @return
 */
public double nextHighestProb(){
  if (dp.size() > 0) {
    return dp.peek().probability;
  }
  return 0;
}
Program: 32964
Project: 32964
Buggy source:
public BMMClassifier build(){
  BMMClassifier bmmClassifier=new BMMClassifier();
  bmmClassifier.numLabels=numClasses;
  bmmClassifier.numClusters=numClusters;
  bmmClassifier.numFeatures=numFeatures;
  bmmClassifier.binaryClassifierType=binaryClassifierType;
  bmmClassifier.multiClassClassifierType=multiClassClassifierType;
switch (binaryClassifierType) {
case "String_Node_Str":
    bmmClassifier.binaryClassifiers=new LogisticRegression[numClusters][numClasses];
  for (int k=0; k < numClusters; k++) {
    for (int l=0; l < numClasses; l++) {
      bmmClassifier.binaryClassifiers[k][l]=new LogisticRegression(2,numFeatures);
    }
  }
break;
case "String_Node_Str":
bmmClassifier.binaryClassifiers=new LKBoost[numClusters][numClasses];
for (int k=0; k < numClusters; k++) {
for (int l=0; l < numClasses; l++) {
bmmClassifier.binaryClassifiers[k][l]=new LKBoost(2);
}
}
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
switch (multiClassClassifierType) {
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LogisticRegression(numClusters,numFeatures,true);
break;
case "String_Node_Str":
bmmClassifier.binaryClassifiers=new LKBoost[numClusters][numClasses];
bmmClassifier.multiClassClassifier=new LKBoost(numClusters);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
return bmmClassifier;
}

Fixed version (ground truth):
public BMMClassifier build(){
  BMMClassifier bmmClassifier=new BMMClassifier();
  bmmClassifier.numLabels=numClasses;
  bmmClassifier.numClusters=numClusters;
  bmmClassifier.numFeatures=numFeatures;
  bmmClassifier.binaryClassifierType=binaryClassifierType;
  bmmClassifier.multiClassClassifierType=multiClassClassifierType;
switch (binaryClassifierType) {
case "String_Node_Str":
    bmmClassifier.binaryClassifiers=new LogisticRegression[numClusters][numClasses];
  for (int k=0; k < numClusters; k++) {
    for (int l=0; l < numClasses; l++) {
      bmmClassifier.binaryClassifiers[k][l]=new LogisticRegression(2,numFeatures);
    }
  }
break;
case "String_Node_Str":
bmmClassifier.binaryClassifiers=new LKBoost[numClusters][numClasses];
for (int k=0; k < numClusters; k++) {
for (int l=0; l < numClasses; l++) {
bmmClassifier.binaryClassifiers[k][l]=new LKBoost(2);
}
}
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
switch (multiClassClassifierType) {
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LogisticRegression(numClusters,numFeatures,true);
break;
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LKBoost(numClusters);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
return bmmClassifier;
}
Program: 32965
Project: 32965
Buggy source:
private static void translateMLClfData(Config config) throws IOException, ClassNotFoundException {
  List<String> libSvmFiles=config.getStrings("String_Node_Str");
  List<String> trecFiles=config.getStrings("String_Node_Str");
  boolean dense=config.getBoolean("String_Node_Str");
  int numFeatures=config.getInt("String_Node_Str");
  for (int i=0; i < libSvmFiles.size(); i++) {
    String libSvmFile=libSvmFiles.get(i);
    String trecFile=trecFiles.get(i);
    System.out.println("String_Node_Str" + libSvmFile);
    MultiLabelClfDataSet dataSet=LibSvmFormat.loadMultiLabelClfDataSet(libSvmFile,dense,numFeatures);
    TRECFormat.save(dataSet,trecFile);
  }
}

Fixed version (ground truth):
private static void translateMLClfData(Config config) throws IOException, ClassNotFoundException {
  List<String> libSvmFiles=config.getStrings("String_Node_Str");
  List<String> trecFiles=config.getStrings("String_Node_Str");
  boolean dense=config.getBoolean("String_Node_Str");
  int numFeatures=config.getInt("String_Node_Str");
  int numClasses=config.getInt("String_Node_Str");
  for (int i=0; i < libSvmFiles.size(); i++) {
    String libSvmFile=libSvmFiles.get(i);
    String trecFile=trecFiles.get(i);
    System.out.println("String_Node_Str" + libSvmFile);
    MultiLabelClfDataSet dataSet=LibSvmFormat.loadMultiLabelClfDataSet(libSvmFile,dense,numFeatures,numClasses);
    TRECFormat.save(dataSet,trecFile);
  }
}
Program: 32966
Project: 32966
Buggy source:
public static MultiLabelClfDataSet loadMultiLabelClfDataSet(String libSvmFile,boolean dense,int numFeatures) throws IOException, ClassNotFoundException {
  int numDatapoints=getNumDataPoints(libSvmFile);
  int numClasses=getNumClasses(libSvmFile);
  System.out.println("String_Node_Str" + numDatapoints);
  System.out.println("String_Node_Str" + numClasses);
  System.out.println("String_Node_Str" + numFeatures);
  MultiLabelClfDataSet dataSet=new MLClfDataSetBuilder().numClasses(numClasses).numFeatures(numFeatures).numDataPoints(numDatapoints).dense(dense).build();
  try (BufferedReader br=new BufferedReader(new FileReader(libSvmFile))){
    String line=null;
    int lineCount=0;
    while ((line=br.readLine()) != null) {
      String[] lineInfo=line.split("String_Node_Str");
      String labels=lineInfo[0];
      for (      String label : labels.split("String_Node_Str")) {
        int l=Integer.parseInt(label);
        dataSet.addLabel(lineCount,l);
      }
      for (int i=1; i < lineInfo.length; i++) {
        String[] featureValue=lineInfo[i].split("String_Node_Str");
        int feature=Integer.parseInt(featureValue[0]);
        double value=Double.parseDouble(featureValue[1]);
        dataSet.setFeatureValue(lineCount,feature - 1,value);
      }
      lineCount++;
    }
    br.close();
  }
   return dataSet;
}

Fixed version (ground truth):
public static MultiLabelClfDataSet loadMultiLabelClfDataSet(String libSvmFile,boolean dense,int numFeatures,int numClasses) throws IOException, ClassNotFoundException {
  int numDatapoints=getNumDataPoints(libSvmFile);
  System.out.println("String_Node_Str" + numDatapoints);
  System.out.println("String_Node_Str" + numClasses);
  System.out.println("String_Node_Str" + numFeatures);
  MultiLabelClfDataSet dataSet=new MLClfDataSetBuilder().numClasses(numClasses).numFeatures(numFeatures).numDataPoints(numDatapoints).dense(dense).build();
  try (BufferedReader br=new BufferedReader(new FileReader(libSvmFile))){
    String line=null;
    int lineCount=0;
    while ((line=br.readLine()) != null) {
      String[] lineInfo=line.split("String_Node_Str");
      String labels=lineInfo[0];
      for (      String label : labels.split("String_Node_Str")) {
        int l=Integer.parseInt(label);
        dataSet.addLabel(lineCount,l);
      }
      for (int i=1; i < lineInfo.length; i++) {
        String[] featureValue=lineInfo[i].split("String_Node_Str");
        int feature=Integer.parseInt(featureValue[0]);
        double value=Double.parseDouble(featureValue[1]);
        dataSet.setFeatureValue(lineCount,feature - 1,value);
      }
      lineCount++;
    }
    br.close();
  }
   return dataSet;
}
Program: 32967
Project: 32967
Buggy source:
private static void fillMultiLabelClfDataSet(MultiLabelClfDataSet dataSet,File trecFile) throws IOException {
  File matrixFile=new File(trecFile,TREC_MATRIX_FILE_NAME);
  try (BufferedReader br=new BufferedReader(new FileReader(matrixFile))){
    String line=null;
    int dataIndex=0;
    while ((line=br.readLine()) != null) {
      String[] lineSplit=line.split("String_Node_Str");
      String multiLabelString=lineSplit[0];
      String[] multiLabelSplit=multiLabelString.split(Pattern.quote("String_Node_Str"));
      for (      String label : multiLabelSplit) {
        if (label.equals("String_Node_Str")) {
          continue;
        }
        dataSet.addLabel(dataIndex,Integer.parseInt(label));
      }
      for (int i=1; i < lineSplit.length; i++) {
        String pair=lineSplit[i];
        if (pair.startsWith("String_Node_Str")) {
          break;
        }
        String[] pairSplit=pair.split("String_Node_Str");
        int featureIndex=Integer.parseInt(pairSplit[0]);
        double featureValue=Double.parseDouble(pairSplit[1]);
        dataSet.setFeatureValue(dataIndex,featureIndex,featureValue);
      }
      dataIndex+=1;
    }
  }
 }

Fixed version (ground truth):
private static void fillMultiLabelClfDataSet(MultiLabelClfDataSet dataSet,File trecFile) throws IOException {
  File matrixFile=new File(trecFile,TREC_MATRIX_FILE_NAME);
  try (BufferedReader br=new BufferedReader(new FileReader(matrixFile))){
    String line=null;
    int dataIndex=0;
    while ((line=br.readLine()) != null) {
      String[] lineSplit=line.split("String_Node_Str");
      String multiLabelString=null;
      try {
        multiLabelString=lineSplit[0];
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
        System.out.println("String_Node_Str" + dataIndex);
        System.out.println("String_Node_Str" + line);
      }
      String[] multiLabelSplit=multiLabelString.split(Pattern.quote("String_Node_Str"));
      for (      String label : multiLabelSplit) {
        if (label.equals("String_Node_Str")) {
          continue;
        }
        dataSet.addLabel(dataIndex,Integer.parseInt(label));
      }
      for (int i=1; i < lineSplit.length; i++) {
        String pair=lineSplit[i];
        if (pair.startsWith("String_Node_Str")) {
          break;
        }
        String[] pairSplit=pair.split("String_Node_Str");
        int featureIndex=Integer.parseInt(pairSplit[0]);
        double featureValue=Double.parseDouble(pairSplit[1]);
        dataSet.setFeatureValue(dataIndex,featureIndex,featureValue);
      }
      dataIndex+=1;
    }
  }
 }
Program: 32968
Project: 32968
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String output=config.getString("String_Node_Str");
  String modelName=config.getString("String_Node_Str");
  String path=output + "String_Node_Str" + modelName;
  int startIter=config.getInt("String_Node_Str");
  int endIter=config.getInt("String_Node_Str");
  MultiLabelClfDataSet dataSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
  MultiLabel[] labels=dataSet.getMultiLabels();
  for (int i=startIter; i < endIter + 1; i++) {
    System.out.println("String_Node_Str" + path + "String_Node_Str"+ i);
    BMMClassifier bmmClassifier=loadModel(config,i);
    MultiLabel[] predictions=bmmClassifier.predict(dataSet);
    double[][] gammas=getGammas(config,i,"String_Node_Str");
    double[][] PIs=getGammas(config,i,"String_Node_Str");
    Map<Double,HashMap<Boolean,Integer>> gammasPerplexityMap=getPerplexity(labels,predictions,gammas);
    Map<Double,HashMap<Boolean,Integer>> PIsPerplexityMap=getPerplexity(labels,predictions,PIs);
    writePerplexityFile(gammasPerplexityMap,path,i,"String_Node_Str");
    writePerplexityFile(gammasPerplexityMap,path,i,"String_Node_Str");
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String output=config.getString("String_Node_Str");
  String modelName=config.getString("String_Node_Str");
  String path=output + "String_Node_Str" + modelName;
  int startIter=config.getInt("String_Node_Str");
  int endIter=config.getInt("String_Node_Str");
  MultiLabelClfDataSet dataSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
  MultiLabel[] labels=dataSet.getMultiLabels();
  for (int i=startIter; i < endIter + 1; i++) {
    System.out.println("String_Node_Str" + path + "String_Node_Str"+ i);
    BMMClassifier bmmClassifier=loadModel(config,i);
    MultiLabel[] predictions=bmmClassifier.predict(dataSet);
    double[][] gammas=getGammas(config,i,"String_Node_Str");
    double[][] PIs=getGammas(config,i,"String_Node_Str");
    Map<Double,HashMap<Boolean,Integer>> gammasPerplexityMap=getPerplexity(labels,predictions,gammas);
    Map<Double,HashMap<Boolean,Integer>> PIsPerplexityMap=getPerplexity(labels,predictions,PIs);
    Map<Double,HashMap<Boolean,Integer>> KLDivergence=getKL(labels,predictions,gammas,PIs);
    writePerplexityFile(gammasPerplexityMap,path,i,"String_Node_Str");
    writePerplexityFile(PIsPerplexityMap,path,i,"String_Node_Str");
    writePerplexityFile(KLDivergence,path,i,"String_Node_Str");
  }
}
Program: 32969
Project: 32969
Buggy source:
static void createTestSet(Config config) throws Exception {
  String[] indexIds;
  String splitMode=config.getString("String_Node_Str");
  ESIndex index=loadIndex(config);
switch (splitMode) {
case "String_Node_Str":
    indexIds=getDocsForSplitFromField(config,index,config.getStrings("String_Node_Str"));
  break;
case "String_Node_Str":
indexIds=getDocsForSplitFromQuery(index,config.getString("String_Node_Str"));
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
createDataSet(config,indexIds,"String_Node_Str");
}

Fixed version (ground truth):
static void createTestSet(Config config) throws Exception {
  String[] indexIds;
  String splitMode=config.getString("String_Node_Str");
  ESIndex index=loadIndex(config);
switch (splitMode) {
case "String_Node_Str":
    indexIds=getDocsForSplitFromField(config,index,config.getStrings("String_Node_Str"));
  break;
case "String_Node_Str":
indexIds=getDocsForSplitFromQuery(index,config.getString("String_Node_Str"));
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
index.close();
createDataSet(config,indexIds,"String_Node_Str");
}
Program: 32970
Project: 32970
Buggy source:
static void createTrainSet(Config config) throws Exception {
  generateMetaData(config);
  String[] indexIds;
  String splitMode=config.getString("String_Node_Str");
  ESIndex index=loadIndex(config);
switch (splitMode) {
case "String_Node_Str":
    indexIds=getDocsForSplitFromField(config,index,config.getStrings("String_Node_Str"));
  break;
case "String_Node_Str":
indexIds=getDocsForSplitFromQuery(index,config.getString("String_Node_Str"));
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
createDataSet(config,indexIds,"String_Node_Str");
}

Fixed version (ground truth):
static void createTrainSet(Config config) throws Exception {
  generateMetaData(config);
  String[] indexIds;
  String splitMode=config.getString("String_Node_Str");
  ESIndex index=loadIndex(config);
switch (splitMode) {
case "String_Node_Str":
    indexIds=getDocsForSplitFromField(config,index,config.getStrings("String_Node_Str"));
  break;
case "String_Node_Str":
indexIds=getDocsForSplitFromQuery(index,config.getString("String_Node_Str"));
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
index.close();
createDataSet(config,indexIds,"String_Node_Str");
}
Program: 32971
Project: 32971
Buggy source:
private void updateBinaryLogisticRegression(int k){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + k);
  }
  IntStream intStream=IntStream.range(0,bmmClassifier.getNumClasses());
  if (isParallel) {
    intStream=intStream.parallel();
  }
  intStream.forEach(l -> {
    updateBinaryClassifier(k,l);
  }
);
}

Fixed version (ground truth):
private void updateBinaryLogisticRegression(int k){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + k);
  }
  IntStream intStream=IntStream.range(0,bmmClassifier.getNumClasses());
  intStream.forEach(l -> {
    updateBinaryClassifier(k,l);
  }
);
}
Program: 32973
Project: 32973
Buggy source:
public BMMClassifier build(){
  BMMClassifier bmmClassifier=new BMMClassifier();
  bmmClassifier.numLabels=numClasses;
  bmmClassifier.numClusters=numClusters;
  bmmClassifier.numFeatures=numFeatures;
  bmmClassifier.binaryClassifierType=binaryClassifierType;
  bmmClassifier.multiClassClassifierType=multiClassClassifierType;
switch (binaryClassifierType) {
case "String_Node_Str":
    bmmClassifier.binaryClassifiers=new LogisticRegression[numClusters][numClasses];
  for (int k=0; k < numClusters; k++) {
    for (int l=0; l < numClasses; l++) {
      bmmClassifier.binaryClassifiers[k][l]=new LogisticRegression(2,numFeatures);
    }
  }
break;
case "String_Node_Str":
bmmClassifier.binaryClassifiers=new LKBoost[numClusters][numClasses];
for (int k=0; k < numClusters; k++) {
for (int l=0; l < numClasses; l++) {
bmmClassifier.binaryClassifiers[k][l]=new LKBoost(2);
}
}
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
switch (multiClassClassifierType) {
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LogisticRegression(numClusters,numFeatures,true);
break;
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LKBoost(numClusters);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
return bmmClassifier;
}

Fixed version (ground truth):
public BMMClassifier build(){
  BMMClassifier bmmClassifier=new BMMClassifier();
  bmmClassifier.numLabels=numClasses;
  bmmClassifier.numClusters=numClusters;
  bmmClassifier.numFeatures=numFeatures;
  bmmClassifier.binaryClassifierType=binaryClassifierType;
  bmmClassifier.multiClassClassifierType=multiClassClassifierType;
switch (binaryClassifierType) {
case "String_Node_Str":
    bmmClassifier.binaryClassifiers=new LogisticRegression[numClusters][numClasses];
  for (int k=0; k < numClusters; k++) {
    for (int l=0; l < numClasses; l++) {
      bmmClassifier.binaryClassifiers[k][l]=new LogisticRegression(2,numFeatures);
    }
  }
break;
case "String_Node_Str":
bmmClassifier.binaryClassifiers=new LKBoost[numClusters][numClasses];
for (int k=0; k < numClusters; k++) {
for (int l=0; l < numClasses; l++) {
bmmClassifier.binaryClassifiers[k][l]=new LKBoost(2);
}
}
break;
default :
throw new IllegalArgumentException("String_Node_Str" + binaryClassifierType);
}
switch (multiClassClassifierType) {
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LogisticRegression(numClusters,numFeatures,true);
break;
case "String_Node_Str":
bmmClassifier.multiClassClassifier=new LKBoost(numClusters);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
return bmmClassifier;
}
Program: 32974
Project: 32974
Buggy source:
public static void main(String[] args) throws Exception {
  test3();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  test1();
}