nus-yam/ex-repair huggingface dataset:
Program: 21345
Project: 21345
Buggy source:
@Override public Clustering getClusteringResult(){
  sourceClustering=new Clustering();
  Instances dataset=getDataset(attributes_.getNumberOfAttributes(),getNumClusters());
  Instances newInstances=new Instances(dataset);
  if (bnModel_ == null) {
    parameterLearningAlgorithm_.setDAG(dag);
    parameterLearningAlgorithm_.initLearning();
    parameterLearningAlgorithm_.updateModel(batch_);
  }
 else {
    parameterLearningAlgorithm_.updateModel(batch_);
  }
  bnModel_=parameterLearningAlgorithm_.getLearntBayesianNetwork();
  predictions_.setModel(bnModel_);
  for (  DataInstance dataInstance : batch_) {
    this.predictions_.setEvidence(dataInstance);
    this.predictions_.runInference();
    Multinomial multinomial=this.predictions_.getPosterior(clusterVar_);
    double[] results=multinomial.getProbabilities();
    int cnum=IntStream.rangeClosed(0,getNumClusters() - 1).reduce((a,b) -> (results[a] > results[b]) ? a : b).getAsInt();
    double[] attValues=dataInstance.getAttributes().getList().stream().mapToDouble(att -> dataInstance.getValue(att)).toArray();
    Instance newInst=new DenseInstance(1.0,attValues);
    newInst.insertAttributeAt(attributes_.getNumberOfAttributes());
    newInst.setDataset(dataset);
    newInst.setClassValue(cnum);
    newInstances.add(newInst);
  }
  clustering=new Clustering(newInstances);
  return sourceClustering;
}

Fixed version (ground truth):
@Override public Clustering getClusteringResult(){
  Instances dataset=getDataset(attributes_.getNumberOfAttributes(),getNumClusters());
  Instances newInstances=new Instances(dataset);
  if (bnModel_ == null) {
    parameterLearningAlgorithm_.setDAG(dag);
    ((SVB)parameterLearningAlgorithm_).setWindowsSize(timeWindowOption.getValue());
    parameterLearningAlgorithm_.initLearning();
    parameterLearningAlgorithm_.updateModel(batch_);
  }
 else {
    parameterLearningAlgorithm_.updateModel(batch_);
  }
  bnModel_=parameterLearningAlgorithm_.getLearntBayesianNetwork();
  predictions_.setModel(bnModel_);
  for (  DataInstance dataInstance : batch_) {
    this.predictions_.setEvidence(dataInstance);
    this.predictions_.runInference();
    Multinomial multinomial=this.predictions_.getPosterior(clusterVar_);
    double[] results=multinomial.getProbabilities();
    int cnum=IntStream.rangeClosed(0,getNumClusters() - 1).reduce((a,b) -> (results[a] > results[b]) ? a : b).getAsInt();
    double[] attValues=dataInstance.toArray();
    Instance newInst=new DenseInstance(1.0,attValues);
    newInst.insertAttributeAt(attributes_.getNumberOfAttributes());
    newInst.setDataset(dataset);
    newInst.setClassValue(cnum);
    newInstances.add(newInst);
  }
  clustering=new Clustering(newInstances);
  return clustering;
}
Program: 21346
Project: 21346
Buggy source:
public DataRowWeka(Instance dataRow){
  this.dataRow=dataRow;
}

Fixed version (ground truth):
public DataRowWeka(Instance dataRow,Attributes attributes_){
  this.dataRow=dataRow;
  this.attributes=attributes_;
}
Program: 21347
Project: 21347
Buggy source:
@Override public Attributes getAttributes(){
  return Converter.convertAttributes(dataRow.enumerateAttributes(),dataRow.classAttribute());
}

Fixed version (ground truth):
@Override public Attributes getAttributes(){
  return this.attributes;
}
Program: 21348
Project: 21348
Buggy source:
@Override public void trainOnInstanceImpl(Instance instance){
  if (batch_ == null) {
    setParallelMode_(parallelModeOption.isSet());
    setNumClusters(numberClustersOption.getValue());
    attributes_=Converter.convertAttributes(getDataset(instance.numAttributes(),0).enumerateAttributes());
    Variables modelHeader=new Variables(attributes_);
    clusterVar_=modelHeader.newMultionomialVariable("String_Node_Str",getNumClusters());
    batch_=new DataOnMemoryListContainer(attributes_);
    predictions_=new VMP();
    predictions_.setSeed(this.randomSeed);
    dag=new DAG(modelHeader);
    if (isParallelMode_()) {
      dag.getParentSets().parallelStream().filter(w -> w.getMainVar().getVarID() != clusterVar_.getVarID()).forEach(w -> w.addParent(clusterVar_));
    }
 else {
      dag.getParentSets().stream().filter(w -> w.getMainVar().getVarID() != clusterVar_.getVarID()).filter(w -> w.getMainVar().isObservable()).forEach(w -> w.addParent(clusterVar_));
    }
    System.out.println(dag.toString());
    parameterLearningAlgorithm_=new SVB();
  }
  if (windowCounter >= timeWindowOption.getValue()) {
    batch_=new DataOnMemoryListContainer(attributes_);
    windowCounter=0;
  }
  DataInstance dataInstance=new DataInstanceImpl(new DataRowWeka(instance));
  windowCounter++;
  batch_.add(dataInstance);
}

Fixed version (ground truth):
@Override public void trainOnInstanceImpl(Instance instance){
  if (batch_ == null) {
    setParallelMode_(parallelModeOption.isSet());
    setNumClusters(numberClustersOption.getValue());
    attributes_=Converter.convertAttributes(getDataset(instance.numAttributes(),0).enumerateAttributes());
    Variables modelHeader=new Variables(attributes_);
    clusterVar_=modelHeader.newMultionomialVariable("String_Node_Str",getNumClusters());
    batch_=new DataOnMemoryListContainer(attributes_);
    predictions_=new VMP();
    predictions_.setSeed(this.randomSeed);
    dag=new DAG(modelHeader);
    if (isParallelMode_()) {
      dag.getParentSets().parallelStream().filter(w -> w.getMainVar().getVarID() != clusterVar_.getVarID()).forEach(w -> w.addParent(clusterVar_));
    }
 else {
      dag.getParentSets().stream().filter(w -> w.getMainVar().getVarID() != clusterVar_.getVarID()).filter(w -> w.getMainVar().isObservable()).forEach(w -> w.addParent(clusterVar_));
    }
    System.out.println(dag.toString());
    parameterLearningAlgorithm_=new SVB();
  }
  if (windowCounter >= timeWindowOption.getValue()) {
    batch_=new DataOnMemoryListContainer(attributes_);
    windowCounter=0;
  }
  DataInstance dataInstance=new DataInstanceImpl(new DataRowWeka(instance,attributes_));
  windowCounter++;
  batch_.add(dataInstance);
}
Program: 21349
Project: 21349
Buggy source:
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList);
}

Fixed version (ground truth):
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return DistributionTypeEnum.FromBaseDistributionToConditionalDistribution(new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList));
}
Program: 21350
Project: 21350
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new BaseDistribution_MultinomialParents<Multinomial>(this.variable,parents);
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new Multinomial_MultinomialParents(this.variable,parents);
}
Program: 21351
Project: 21351
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new BaseDistribution_MultinomialParents<Normal>(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new BaseDistribution_MultinomialParents<ConditionalLinearGaussian>(this.variable,parents);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new Normal_MultinomialParents(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new Normal_MultinomialNormalParents(this.variable,parents);
  }
 else {
    return null;
  }
}
Program: 21352
Project: 21352
Buggy source:
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        System.out.println("String_Node_Str" + fileName);
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}
Program: 21354
Project: 21354
Buggy source:
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList);
}

Fixed version (ground truth):
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return DistributionTypeEnum.FromBaseDistributionToConditionalDistribution(new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList));
}
Program: 21355
Project: 21355
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new BaseDistribution_MultinomialParents<Multinomial>(this.variable,parents);
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new Multinomial_MultinomialParents(this.variable,parents);
}
Program: 21356
Project: 21356
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new BaseDistribution_MultinomialParents<Normal>(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new BaseDistribution_MultinomialParents<ConditionalLinearGaussian>(this.variable,parents);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new Normal_MultinomialParents(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new Normal_MultinomialNormalParents(this.variable,parents);
  }
 else {
    return null;
  }
}
Program: 21357
Project: 21357
Buggy source:
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        System.out.println("String_Node_Str" + fileName);
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}
Program: 21359
Project: 21359
Buggy source:
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList);
}

Fixed version (ground truth):
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return DistributionTypeEnum.FromBaseDistributionToConditionalDistribution(new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList));
}
Program: 21360
Project: 21360
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new BaseDistribution_MultinomialParents<Multinomial>(this.variable,parents);
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new Multinomial_MultinomialParents(this.variable,parents);
}
Program: 21361
Project: 21361
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new BaseDistribution_MultinomialParents<Normal>(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new BaseDistribution_MultinomialParents<ConditionalLinearGaussian>(this.variable,parents);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new Normal_MultinomialParents(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new Normal_MultinomialNormalParents(this.variable,parents);
  }
 else {
    return null;
  }
}
Program: 21362
Project: 21362
Buggy source:
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        System.out.println("String_Node_Str" + fileName);
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}
Program: 21364
Project: 21364
Buggy source:
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList);
}

Fixed version (ground truth):
@Override public ConditionalDistribution toConditionalDistribution(Map<Variable,Vector> expectedValueParameterVariables){
  List<Distribution> distributionList=new ArrayList();
  for (  EF_Distribution dist : this.distributions) {
    EF_ConditionalDistribution learningDistribution=(EF_ConditionalDistribution)dist;
    ConditionalDistribution conditionalDistribution=learningDistribution.toConditionalDistribution(expectedValueParameterVariables);
    if (conditionalDistribution instanceof BaseDistribution_MultinomialParents) {
      BaseDistribution_MultinomialParents base=(BaseDistribution_MultinomialParents)conditionalDistribution;
      distributionList.add(base.getBaseDistribution(0));
    }
 else {
      distributionList.add(conditionalDistribution);
    }
  }
  return DistributionTypeEnum.FromBaseDistributionToConditionalDistribution(new BaseDistribution_MultinomialParents(this.multinomialParents,distributionList));
}
Program: 21365
Project: 21365
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new BaseDistribution_MultinomialParents<Multinomial>(this.variable,parents);
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  if (parents.isEmpty())   return (E)new Multinomial(this.variable);
 else   return (E)new Multinomial_MultinomialParents(this.variable,parents);
}
Program: 21366
Project: 21366
Buggy source:
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new BaseDistribution_MultinomialParents<Normal>(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new BaseDistribution_MultinomialParents<ConditionalLinearGaussian>(this.variable,parents);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public <E extends ConditionalDistribution>E newConditionalDistribution(List<Variable> parents){
  if (!this.areParentsCompatible(parents))   throw new IllegalArgumentException("String_Node_Str");
  boolean multinomialParents=false;
  boolean normalParents=false;
  for (  Variable v : parents) {
    if (v.isMultinomial() || (v.isMultinomialLogistic())) {
      multinomialParents=true;
    }
 else     if (v.isNormal()) {
      normalParents=true;
    }
  }
  if (!multinomialParents && !normalParents) {
    return (E)new Normal(this.variable);
  }
 else   if (multinomialParents && !normalParents) {
    return (E)new Normal_MultinomialParents(this.variable,parents);
  }
 else   if (!multinomialParents && normalParents) {
    return (E)new ConditionalLinearGaussian(this.variable,parents);
  }
 else   if (multinomialParents && normalParents) {
    return (E)new Normal_MultinomialNormalParents(this.variable,parents);
  }
 else {
    return null;
  }
}
Program: 21367
Project: 21367
Buggy source:
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public static void loadAndTestFilesFromFolder(final String folderName) throws Exception {
  File folder=new File(folderName);
  for (  final File fileEntry : folder.listFiles()) {
    if (fileEntry.isDirectory()) {
      loadAndTestFilesFromFolder(fileEntry.getName());
    }
 else {
      String fileName=fileEntry.getName();
      String fullFileName=folderName + "String_Node_Str" + fileName;
      if (fileName.endsWith("String_Node_Str")) {
        System.out.println("String_Node_Str" + fileName);
        BayesianNetwork amidstBN=BayesianNetworkLoader.loadFromFile(fullFileName);
        BayesianNetworkWriter.saveToFile(amidstBN,fullFileName);
        BayesianNetwork amidstBN2=BayesianNetworkLoader.loadFromFile(fullFileName);
        if (!amidstBN.equalBNs(amidstBN2,0.0))         throw new Exception("String_Node_Str" + fileName + "String_Node_Str");
      }
    }
  }
}
Program: 21375
Project: 21375
Buggy source:
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  BayesianNetwork bNet=null;
  for (int i=0; i < NbrClients; i++) {
    Multinomial uniform=new Multinomial(classVariable_PM);
    uniform.setProbabilityOfState(DEFAULTER_VALUE_INDEX,0.5);
    uniform.setProbabilityOfState(NON_DEFAULTER_VALUE_INDEX,0.5);
    posteriors.put(i,uniform);
  }
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 11; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonth(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}

Fixed version (ground truth):
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}
Program: 21376
Project: 21376
Buggy source:
public BayesianNetwork train(DataOnMemory<DataInstance> data,StaticVariables allVars,List<Variable> SF,boolean includeClassVariablePM){
  DAG dag=new DAG(allVars);
  if (data.getDataInstance(0).getValue(TIME_ID) != 0 && includeClassVariablePM)   dag.getParentSet(classVariable).addParent(classVariable_PM);
  dag.getParentSets().stream().filter(parent -> SF.contains(parent.getMainVar())).filter(w -> w.getMainVar().getVarID() != classVariable.getVarID()).forEach(w -> w.addParent(classVariable));
  StreamingVariationalBayesVMP vmp=new StreamingVariationalBayesVMP();
  vmp.setDAG(dag);
  vmp.setDataStream(data);
  vmp.setWindowsSize(100);
  vmp.runLearning();
  return vmp.getLearntBayesianNetwork();
}

Fixed version (ground truth):
public BayesianNetwork train(DataOnMemory<DataInstance> data,StaticVariables allVars,List<Variable> SF){
  DAG dag=new DAG(allVars);
  if (data.getDataInstance(0).getValue(TIME_ID) != 0)   dag.getParentSet(classVariable).addParent(classVariable_PM);
  dag.getParentSets().stream().filter(parent -> SF.contains(parent.getMainVar())).filter(w -> w.getMainVar().getVarID() != classVariable.getVarID()).forEach(w -> w.addParent(classVariable));
  StreamingVariationalBayesVMP vmp=new StreamingVariationalBayesVMP();
  vmp.setDAG(dag);
  vmp.setDataStream(data);
  vmp.setWindowsSize(100);
  vmp.runLearning();
  return vmp.getLearntBayesianNetwork();
}
Program: 21377
Project: 21377
Buggy source:
public static void main(String[] args) throws IOException {
  DataStream<DataInstance> data=DataStreamLoader.loadFromFile("String_Node_Str");
  for (int i=1; i < args.length; i++) {
    if (args[i].equalsIgnoreCase("String_Node_Str"))     setUsePRCArea(true);
    if (args[i].equalsIgnoreCase("String_Node_Str"))     setNonDeterministic(true);
  }
  wrapperBN wbnet=new wrapperBN();
  wbnet.learnCajamarModel(data);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  DataStream<DataInstance> data=DataStreamLoader.loadFromFile("String_Node_Str");
  for (int i=1; i < args.length; i++) {
    if (args[i].equalsIgnoreCase("String_Node_Str"))     setUsePRCArea(true);
    if (args[i].equalsIgnoreCase("String_Node_Str"))     setNonDeterministic(true);
    if (args[i].equalsIgnoreCase("String_Node_Str"))     setNB(true);
  }
  wrapperBN wbnet=new wrapperBN();
  wbnet.learnCajamarModel(data);
}
Program: 21381
Project: 21381
Buggy source:
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    int idMonthMinus12=(int)monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(idMonthMinus12 + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}

Fixed version (ground truth):
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=0;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  while (iterator.hasNext()) {
    int idMonthMinus12=(int)monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID);
    BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.poll());
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(idMonthMinus12 + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}
Program: 21383
Project: 21383
Buggy source:
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}

Fixed version (ground truth):
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    int idMonthMinus12=(int)monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(idMonthMinus12 + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}
Program: 21385
Project: 21385
Buggy source:
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}

Fixed version (ground truth):
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    int idMonthMinus12=(int)monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(idMonthMinus12 + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}
Program: 21388
Project: 21388
Buggy source:
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  BayesianNetwork bNet=null;
  for (int i=0; i < NbrClients; i++) {
    Multinomial uniform=new Multinomial(classVariable_PM);
    uniform.setProbabilityOfState(DEFAULTER_VALUE_INDEX,0.5);
    uniform.setProbabilityOfState(NON_DEFAULTER_VALUE_INDEX,0.5);
    posteriors.put(i,uniform);
  }
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 11; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonth(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}

Fixed version (ground truth):
void learnCajamarModel(DataStream<DataInstance> data){
  StaticVariables Vars=new StaticVariables(data.getAttributes());
  classVariable=Vars.getVariableById(Vars.getNumberOfVars() - 1);
  classVariable_PM=Vars.getVariableById(Vars.getNumberOfVars() - 2);
  TIME_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  SEQUENCE_ID=data.getAttributes().getAttributeByName("String_Node_Str");
  int count=NbrClients;
  double averageAUC=0;
  Iterable<DataOnMemory<DataInstance>> iteratable=data.iterableOverBatches(NbrClients);
  Iterator<DataOnMemory<DataInstance>> iterator=iteratable.iterator();
  Queue<DataOnMemory<DataInstance>> monthsMinus12to0=new LinkedList<>();
  for (int i=0; i < 2; i++) {
    monthsMinus12to0.add(iterator.next());
  }
  BayesianNetwork bn=wrapperBNOneMonthNB(monthsMinus12to0.peek());
  while (iterator.hasNext()) {
    DataOnMemory<DataInstance> currentMonth=iterator.next();
    monthsMinus12to0.add(currentMonth);
    double auc=propagateAndTest(monthsMinus12to0,bn);
    System.out.println(monthsMinus12to0.peek().getDataInstance(0).getValue(TIME_ID) + "String_Node_Str" + auc);
    averageAUC+=auc;
    count+=NbrClients;
    monthsMinus12to0.remove();
  }
  System.out.println("String_Node_Str" + averageAUC / (count / NbrClients));
}