Program: 21238
Project: 21238
Buggy source:
public static void printOutput(int currentMonth) throws Exception {
  BayesianNetwork bnSVB=svb.getLearntBayesianNetwork();
  BayesianNetwork bnDriftSVB=driftSVB.getLearntBayesianNetwork();
  BayesianNetwork bnStochasticVI=stochasticVI.getLearntBayesianNetwork();
  BayesianNetwork bnPopulationVI=populationVI.getLearntBayesianNetwork();
  double[] meanML=new double[2], meanSVB=new double[2], meanDriftSVB=new double[2], meanStochasticVI=new double[2], meanPopulationVI=new double[2], realMean=new double[2];
  Variable var=dag.getVariables().getVariableByName("String_Node_Str");
  if (!includeClassVar) {
    meanSVB[0]=((ConditionalLinearGaussian)bnSVB.getConditionalDistribution(var)).getIntercept();
    meanDriftSVB[0]=((ConditionalLinearGaussian)bnDriftSVB.getConditionalDistribution(var)).getIntercept();
    meanStochasticVI[0]=((ConditionalLinearGaussian)bnStochasticVI.getConditionalDistribution(var)).getIntercept();
    meanPopulationVI[0]=((ConditionalLinearGaussian)bnPopulationVI.getConditionalDistribution(var)).getIntercept();
  }
 else {
    for (int i=0; i < 2; i++) {
      meanSVB[i]=((Normal_MultinomialNormalParents)bnSVB.getConditionalDistribution(var)).getNormal_NormalParentsDistribution(i).getIntercept();
      meanDriftSVB[i]=((Normal_MultinomialNormalParents)bnDriftSVB.getConditionalDistribution(var)).getNormal_NormalParentsDistribution(i).getIntercept();
      meanStochasticVI[i]=((Normal_MultinomialNormalParents)bnStochasticVI.getConditionalDistribution(var)).getNormal_NormalParentsDistribution(i).getIntercept();
      meanPopulationVI[i]=((Normal_MultinomialNormalParents)bnPopulationVI.getConditionalDistribution(var)).getNormal_NormalParentsDistribution(i).getIntercept();
    }
  }
  String means="String_Node_Str";
  for (int i=0; i < 2; i++) {
    if (i != 0)     means+="String_Node_Str";
    means+=currentMonth + "String_Node_Str" + realMean[i]+ "String_Node_Str"+ meanML[i]+ "String_Node_Str"+ meanSVB[i]+ "String_Node_Str"+ meanDriftSVB[i]+ "String_Node_Str"+ meanStochasticVI[i]+ "String_Node_Str"+ meanPopulationVI[i];
  }
  writerMean.println(means);
  writerLambda.println(currentMonth + "String_Node_Str" + driftSVB.getLambdaValue());
}

Fixed version (ground truth):
public static void printOutput(int currentMonth) throws Exception {
  BayesianNetwork bnML=ml.getLearntBayesianNetwork();
  BayesianNetwork bnSVB=svb.getLearntBayesianNetwork();
  BayesianNetwork bnDriftSVB=driftSVB.getLearntBayesianNetwork();
  BayesianNetwork bnStochasticVI=stochasticVI.getLearntBayesianNetwork();
  BayesianNetwork bnPopulationVI=populationVI.getLearntBayesianNetwork();
  BayesianNetwork bnMLPerBatch=mlPerBatch.getLearntBayesianNetwork();
  double[] meanML=new double[2], meanSVB=new double[2], meanDriftSVB=new double[2], meanStochasticVI=new double[2], meanPopulationVI=new double[2], realMean=new double[2];
  Variable var01=dag.getVariables().getVariableByName("String_Node_Str");
  Variable var10=dag.getVariables().getVariableByName("String_Node_Str");
  List<Variable> varsToCheck=new ArrayList<>();
  varsToCheck.add(var01);
  varsToCheck.add(var10);
  String means="String_Node_Str";
  for (  Variable var : varsToCheck) {
    if (!includeClassVar) {
      meanML[0]=((Normal)bnML.getConditionalDistribution(var)).getMean();
      meanSVB[0]=((Normal)bnSVB.getConditionalDistribution(var)).getMean();
      meanDriftSVB[0]=((Normal)bnDriftSVB.getConditionalDistribution(var)).getMean();
      meanStochasticVI[0]=((Normal)bnStochasticVI.getConditionalDistribution(var)).getMean();
      meanPopulationVI[0]=((Normal)bnPopulationVI.getConditionalDistribution(var)).getMean();
      realMean[0]=((Normal)bnMLPerBatch.getConditionalDistribution(var)).getMean();
    }
 else {
      for (int i=0; i < 2; i++) {
        meanML[i]=((Normal_MultinomialParents)bnML.getConditionalDistribution(var)).getNormal(i).getMean();
        meanSVB[i]=((Normal_MultinomialParents)bnSVB.getConditionalDistribution(var)).getNormal(i).getMean();
        meanDriftSVB[i]=((Normal_MultinomialParents)bnDriftSVB.getConditionalDistribution(var)).getNormal(i).getMean();
        meanStochasticVI[i]=((Normal_MultinomialParents)bnStochasticVI.getConditionalDistribution(var)).getNormal(i).getMean();
        meanPopulationVI[i]=((Normal_MultinomialParents)bnPopulationVI.getConditionalDistribution(var)).getNormal(i).getMean();
        realMean[i]=((Normal_MultinomialParents)bnMLPerBatch.getConditionalDistribution(var)).getNormal(i).getMean();
      }
    }
    for (int i=0; i < 2; i++) {
      if (i != 0)       means+="String_Node_Str";
      means+=currentMonth + "String_Node_Str" + realMean[i]+ "String_Node_Str"+ meanML[i]+ "String_Node_Str"+ meanSVB[i]+ "String_Node_Str"+ meanDriftSVB[i]+ "String_Node_Str"+ meanStochasticVI[i]+ "String_Node_Str"+ meanPopulationVI[i];
    }
    means+="String_Node_Str";
  }
  writerMean.println(means);
  writerLambda.println(currentMonth + "String_Node_Str" + driftSVB.getLambdaValue());
}