nus-yam/ex-repair huggingface dataset:
Program: 21266
Project: 21266
Buggy source:
public static void main(String[] args) throws Exception {
  String fileName=args[0];
  int windowSize=Integer.parseInt(args[1]);
  int localIter=Integer.parseInt(args[2]);
  long timeLimit=Long.parseLong(args[3]);
  int seed=Integer.parseInt(args[4]);
  int dataSetSize=Integer.parseInt(args[5]);
  double learningRate=Double.parseDouble(args[6]);
  final ExecutionEnvironment env=ExecutionEnvironment.getExecutionEnvironment();
  DataFlink<DataInstance> dataFlink=DataFlinkLoader.loadDataFromFolder(env,fileName,true);
  DAG hiddenNB=getDAGstructure(dataFlink.getAttributes());
  long start=System.nanoTime();
  StochasticVI stochasticVI=new StochasticVI();
  stochasticVI.setLocalThreshold(0.1);
  stochasticVI.setMaximumLocalIterations(localIter);
  stochasticVI.setSeed(seed);
  stochasticVI.setBatchSize(windowSize);
  stochasticVI.setLearningFactor(learningRate);
  stochasticVI.setDataSetSize(dataSetSize);
  stochasticVI.setTimiLimit(timeLimit);
  stochasticVI.setDAG(hiddenNB);
  stochasticVI.setDataFlink(dataFlink);
  stochasticVI.runLearning();
  BayesianNetwork LearnedBnet=stochasticVI.getLearntBayesianNetwork();
  System.out.println(LearnedBnet.toString());
  long duration=(System.nanoTime() - start) / 1;
  double seconds=duration / 1000000000.0;
  logger.info("String_Node_Str",seconds);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String fileName=args[0];
  int windowSize=Integer.parseInt(args[1]);
  int localIter=Integer.parseInt(args[2]);
  long timeLimit=Long.parseLong(args[3]);
  int seed=Integer.parseInt(args[4]);
  int dataSetSize=Integer.parseInt(args[5]);
  double learningRate=Double.parseDouble(args[6]);
  final ExecutionEnvironment env=ExecutionEnvironment.getExecutionEnvironment();
  DataFlink<DataInstance> dataFlink=DataFlinkLoader.loadDataFromFolder(env,fileName,false);
  DAG hiddenNB=getIDALocalGlobalDAG(dataFlink.getAttributes());
  long start=System.nanoTime();
  StochasticVI stochasticVI=new StochasticVI();
  stochasticVI.setLocalThreshold(0.1);
  stochasticVI.setMaximumLocalIterations(localIter);
  stochasticVI.setSeed(seed);
  stochasticVI.setBatchSize(windowSize);
  stochasticVI.setLearningFactor(learningRate);
  stochasticVI.setDataSetSize(dataSetSize);
  stochasticVI.setTimiLimit(timeLimit);
  List<Variable> hiddenVars=new ArrayList<>();
  hiddenVars.add(hiddenNB.getVariables().getVariableByName("String_Node_Str"));
  stochasticVI.setPlateuStructure(new PlateuStructure(hiddenVars));
  stochasticVI.setDAG(hiddenNB);
  stochasticVI.setDataFlink(dataFlink);
  stochasticVI.runLearning();
  BayesianNetwork LearnedBnet=stochasticVI.getLearntBayesianNetwork();
  System.out.println(LearnedBnet.toString());
  long duration=(System.nanoTime() - start) / 1;
  double seconds=duration / 1000000000.0;
  logger.info("String_Node_Str",seconds);
}
Program: 21267
Project: 21267
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public SufficientStatistics createInitSufficientStatistics(){
  ArrayVectorParameter vector=new ArrayVectorParameter(this.sizeOfSufficientStatistics());
  vector.set(0,0);
  vector.set(1,0.000001);
  return vector;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public SufficientStatistics createInitSufficientStatistics(){
  ArrayVector vector=new ArrayVector(this.sizeOfSufficientStatistics());
  double mean=0;
  double precision=0.000001;
  vector.set(0,mean * precision);
  vector.set(1,-0.5 * precision);
  return vector;
}
Program: 21268
Project: 21268
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public SufficientStatistics createInitSufficientStatistics(){
  ArrayVectorParameter vector=new ArrayVectorParameter(this.sizeOfSufficientStatistics());
  vector.set(0,0);
  vector.set(1,0.000001);
  return vector;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public SufficientStatistics createInitSufficientStatistics(){
  ArrayVector vector=new ArrayVector(this.sizeOfSufficientStatistics());
  double mean=0;
  double precision=0.000001;
  vector.set(0,mean * precision);
  vector.set(1,-0.5 * precision);
  return vector;
}
Program: 21269
Project: 21269
Buggy source:
/** 
 * Creates a new Attributes from a given List of attribute objects.
 * @param attributes a non-empty list of Attribute objects.
 */
public Attributes(List<Attribute> attributes){
  attributes.sort((a,b) -> a.getIndex() - b.getIndex());
  this.attributes=attributes;
  this.time_id=null;
  this.seq_id=null;
  for (  Attribute att : getFullListOfAttributes()) {
    String name=att.getName();
    if (name.equals(Attributes.TIME_ID_ATT_NAME)) {
      this.time_id=att;
      this.time_id.setSpecialAttribute(true);
      this.time_id.setTimeId(true);
      this.time_id.setNumberFormat(new DecimalFormat("String_Node_Str"));
    }
 else     if (name.equals(Attributes.SEQUENCE_ID_ATT_NAME)) {
      this.seq_id=att;
      this.seq_id.setSpecialAttribute(true);
      this.seq_id.setSeqId(true);
      this.seq_id.setNumberFormat(new DecimalFormat("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a new Attributes from a given List of attribute objects.
 * @param attributes a non-empty list of Attribute objects.
 */
public Attributes(List<Attribute> attributes){
  attributes.sort((a,b) -> a.getIndex() - b.getIndex());
  this.attributes=attributes;
  this.time_id=null;
  this.seq_id=null;
  for (  Attribute att : getFullListOfAttributes()) {
    String name=att.getName();
    if (name.equals(Attributes.TIME_ID_ATT_NAME)) {
      this.time_id=att;
      this.time_id.setSpecialAttribute(true);
      this.time_id.setTimeId(true);
    }
 else     if (name.equals(Attributes.SEQUENCE_ID_ATT_NAME)) {
      this.seq_id=att;
      this.seq_id.setSpecialAttribute(true);
      this.seq_id.setSeqId(true);
    }
  }
}
Program: 21270
Project: 21270
Buggy source:
public static String dataInstanceToARFFString(Attribute att,DataInstance assignment,String separator){
  StringBuilder builder=new StringBuilder();
  if (Utils.isMissingValue(assignment.getValue(att))) {
    builder.append("String_Node_Str");
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.FINITE_SET) {
    FiniteStateSpace stateSpace=att.getStateSpaceType();
    String nameState=stateSpace.getStatesName((int)assignment.getValue(att));
    builder.append(nameState + separator);
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.REAL) {
    if (att.getNumberFormat() != null) {
      builder.append(att.getNumberFormat().format(assignment.getValue(att)) + separator);
    }
 else {
      builder.append(assignment.getValue(att) + separator);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + att.getStateSpaceType().getStateSpaceTypeEnum());
  }
  return builder.toString();
}

Fixed version (ground truth):
public static String dataInstanceToARFFString(Attribute att,DataInstance assignment,String separator){
  StringBuilder builder=new StringBuilder();
  if (Utils.isMissingValue(assignment.getValue(att))) {
    builder.append("String_Node_Str");
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.FINITE_SET) {
    FiniteStateSpace stateSpace=att.getStateSpaceType();
    String nameState=stateSpace.getStatesName((int)assignment.getValue(att));
    builder.append(nameState + separator);
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.REAL) {
    if (att.isSpecialAttribute() || att.isTimeId()) {
      builder.append(decimalFormat.format(assignment.getValue(att)) + separator);
    }
 else {
      builder.append(assignment.getValue(att) + separator);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + att.getStateSpaceType().getStateSpaceTypeEnum());
  }
  return builder.toString();
}
Program: 21271
Project: 21271
Buggy source:
/** 
 * Initialises the class for concept drift detection.
 */
public void initLearning(){
  if (classIndex == -1)   classIndex=attributes.getNumberOfAttributes() - 1;
switch (this.conceptDriftDetector) {
case GLOBAL:
    this.buildGlobalDAG();
  break;
}
svb=new ParallelVB();
svb.setSeed(this.seed);
svb.setPlateuStructure(new PlateuStructure(hiddenVars));
GaussianHiddenTransitionMethod gaussianHiddenTransitionMethod=new GaussianHiddenTransitionMethod(hiddenVars,0,this.transitionVariance);
gaussianHiddenTransitionMethod.setFading(1.0);
svb.setTransitionMethod(gaussianHiddenTransitionMethod);
svb.setBatchSize(this.batchSize);
svb.setDAG(globalDAG);
svb.setOutput(false);
svb.setMaximumGlobalIterations(100);
svb.setMaximumLocalIterations(100);
svb.setGlobalThreshold(0.00001);
svb.setLocalThreshold(0.01);
svb.initLearning();
}

Fixed version (ground truth):
/** 
 * Initialises the class for concept drift detection.
 */
public void initLearning(){
  if (classIndex == -1)   classIndex=attributes.getNumberOfAttributes() - 1;
switch (this.conceptDriftDetector) {
case GLOBAL:
    this.buildGlobalDAG();
  break;
}
svb=new ParallelVB();
svb.setSeed(this.seed);
svb.setPlateuStructure(new PlateuStructure(hiddenVars));
GaussianHiddenTransitionMethod gaussianHiddenTransitionMethod=new GaussianHiddenTransitionMethod(hiddenVars,0,this.transitionVariance);
gaussianHiddenTransitionMethod.setFading(1.0);
svb.setTransitionMethod(gaussianHiddenTransitionMethod);
svb.setBatchSize(this.batchSize);
svb.setDAG(globalDAG);
svb.setOutput(false);
svb.setMaximumGlobalIterations(100);
svb.setMaximumLocalIterations(100);
svb.setGlobalThreshold(0.01);
svb.setLocalThreshold(0.01);
svb.initLearning();
}
Program: 21272
Project: 21272
Buggy source:
@Override public CompoundVector map(DataOnMemory<DataInstance> dataBatch) throws Exception {
  if (dataBatch.getNumberOfDataInstances() == 0) {
    elbo.aggregate(basedELBO);
    return prior;
  }
 else {
    SVB.BatchOutput out=svb.updateModelOnBatchParallel(dataBatch);
    if (Double.isNaN(out.getElbo()))     throw new IllegalStateException("String_Node_Str");
    elbo.aggregate(svb.getPlateuStructure().getReplicatedNodes().filter(node -> node.isActive()).mapToDouble(node -> svb.getPlateuStructure().getVMP().computeELBO(node)).sum());
    return out.getVector();
  }
}

Fixed version (ground truth):
@Override public CompoundVector map(DataOnMemory<DataInstance> dataBatch) throws Exception {
  if (dataBatch.getNumberOfDataInstances() == 0) {
    elbo.aggregate(basedELBO);
    return prior;
  }
 else {
    this.svb.updateNaturalParameterPrior(updatedPrior);
    this.svb.updateNaturalParameterPosteriors(updatedPrior);
    svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(false));
    SVB.BatchOutput out=svb.updateModelOnBatchParallel(dataBatch);
    if (Double.isNaN(out.getElbo()))     throw new IllegalStateException("String_Node_Str");
    elbo.aggregate(out.getElbo());
    svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(true));
    if (partialVectors.containsKey(dataBatch.getBatchID())) {
      CompoundVector newVector=Serialization.deepCopy(updatedPrior);
      newVector.substract(partialVectors.get(dataBatch.getBatchID()));
      this.svb.updateNaturalParameterPrior(newVector);
      this.svb.updateNaturalParameterPosteriors(newVector);
    }
 else {
      this.svb.updateNaturalParameterPrior(this.prior);
      this.svb.getPlateuStructure().setSeed(this.svb.getSeed());
      this.svb.getPlateuStructure().resetQs();
    }
    out=svb.updateModelOnBatchParallel(dataBatch);
    partialVectors.put(dataBatch.getBatchID(),out.getVector());
    return out.getVector();
  }
}
Program: 21273
Project: 21273
Buggy source:
@Override public boolean isConverged(int iteration,DoubleValue value){
  if (Double.isNaN(value.getValue()))   throw new IllegalStateException("String_Node_Str");
  double percentage=100 * (value.getValue() - previousELBO) / Math.abs(previousELBO);
  if (iteration == 1) {
    previousELBO=value.getValue();
    logger.info("String_Node_Str",iteration,100,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ 100+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    return false;
  }
 else   if (percentage < 0 && percentage < -threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return true;
  }
 else   if (percentage > 0 && percentage > threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else {
    logger.info("String_Node_Str",iteration,percentage,value.getValue());
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ value.getValue());
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isConverged(int iteration,DoubleValue value){
  if (Double.isNaN(value.getValue()))   throw new IllegalStateException("String_Node_Str");
  if (value.getValue() == Double.NEGATIVE_INFINITY)   value.setValue(-Double.MAX_VALUE);
  double percentage=100 * (value.getValue() - previousELBO) / Math.abs(previousELBO);
  if (iteration == 1) {
    previousELBO=value.getValue();
    logger.info("String_Node_Str",iteration,100,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ 100+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    return false;
  }
 else   if (percentage < 0 && percentage < -threshold) {
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else   if (percentage > 0 && percentage > threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else {
    logger.info("String_Node_Str",iteration,percentage,value.getValue());
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ value.getValue());
    return true;
  }
}
Program: 21274
Project: 21274
Buggy source:
@Override public void mapPartition(Iterable<T> values,Collector<DataOnMemory<T>> out) throws Exception {
  int count=0;
  DataOnMemoryListContainer<T> batch=new DataOnMemoryListContainer<T>(this.attributes);
  for (  T value : values) {
    if (count < batchSize) {
      batch.add(value);
      count++;
    }
 else {
      out.collect(batch);
      batch=new DataOnMemoryListContainer<T>(this.attributes);
      batch.add(value);
      count=1;
    }
  }
  if (batch.getNumberOfDataInstances() > 0)   out.collect(batch);
}

Fixed version (ground truth):
@Override public void mapPartition(Iterable<T> values,Collector<DataOnMemory<T>> out) throws Exception {
  int index=this.getRuntimeContext().getIndexOfThisSubtask() * 100000;
  int batchCount=0;
  int count=0;
  DataOnMemoryListContainer<T> batch=new DataOnMemoryListContainer<T>(this.attributes);
  for (  T value : values) {
    if (count < batchSize) {
      batch.add(value);
      count++;
    }
 else {
      batch.setId(batchCount + index);
      out.collect(batch);
      batch=new DataOnMemoryListContainer<T>(this.attributes);
      batch.add(value);
      count=1;
      batchCount++;
    }
  }
  if (batch.getNumberOfDataInstances() > 0) {
    batch.setId(batchCount + index);
    out.collect(batch);
  }
}
Program: 21275
Project: 21275
Buggy source:
/** 
 * Creates a new Attributes from a given List of attribute objects.
 * @param attributes a non-empty list of Attribute objects.
 */
public Attributes(List<Attribute> attributes){
  attributes.sort((a,b) -> a.getIndex() - b.getIndex());
  this.attributes=attributes;
  this.time_id=null;
  this.seq_id=null;
  for (  Attribute att : getFullListOfAttributes()) {
    String name=att.getName();
    if (name.equals(Attributes.TIME_ID_ATT_NAME)) {
      this.time_id=att;
      this.time_id.setSpecialAttribute(true);
      this.time_id.setTimeId(true);
      this.time_id.setNumberFormat(new DecimalFormat("String_Node_Str"));
    }
 else     if (name.equals(Attributes.SEQUENCE_ID_ATT_NAME)) {
      this.seq_id=att;
      this.seq_id.setSpecialAttribute(true);
      this.seq_id.setSeqId(true);
      this.seq_id.setNumberFormat(new DecimalFormat("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a new Attributes from a given List of attribute objects.
 * @param attributes a non-empty list of Attribute objects.
 */
public Attributes(List<Attribute> attributes){
  attributes.sort((a,b) -> a.getIndex() - b.getIndex());
  this.attributes=attributes;
  this.time_id=null;
  this.seq_id=null;
  for (  Attribute att : getFullListOfAttributes()) {
    String name=att.getName();
    if (name.equals(Attributes.TIME_ID_ATT_NAME)) {
      this.time_id=att;
      this.time_id.setSpecialAttribute(true);
      this.time_id.setTimeId(true);
    }
 else     if (name.equals(Attributes.SEQUENCE_ID_ATT_NAME)) {
      this.seq_id=att;
      this.seq_id.setSpecialAttribute(true);
      this.seq_id.setSeqId(true);
    }
  }
}
Program: 21276
Project: 21276
Buggy source:
public static String dataInstanceToARFFString(Attribute att,DataInstance assignment,String separator){
  StringBuilder builder=new StringBuilder();
  if (Utils.isMissingValue(assignment.getValue(att))) {
    builder.append("String_Node_Str");
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.FINITE_SET) {
    FiniteStateSpace stateSpace=att.getStateSpaceType();
    String nameState=stateSpace.getStatesName((int)assignment.getValue(att));
    builder.append(nameState + separator);
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.REAL) {
    if (att.getNumberFormat() != null) {
      builder.append(att.getNumberFormat().format(assignment.getValue(att)) + separator);
    }
 else {
      builder.append(assignment.getValue(att) + separator);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + att.getStateSpaceType().getStateSpaceTypeEnum());
  }
  return builder.toString();
}

Fixed version (ground truth):
public static String dataInstanceToARFFString(Attribute att,DataInstance assignment,String separator){
  StringBuilder builder=new StringBuilder();
  if (Utils.isMissingValue(assignment.getValue(att))) {
    builder.append("String_Node_Str");
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.FINITE_SET) {
    FiniteStateSpace stateSpace=att.getStateSpaceType();
    String nameState=stateSpace.getStatesName((int)assignment.getValue(att));
    builder.append(nameState + separator);
  }
 else   if (att.getStateSpaceType().getStateSpaceTypeEnum() == StateSpaceTypeEnum.REAL) {
    if (att.isSpecialAttribute() || att.isTimeId()) {
      builder.append(decimalFormat.format(assignment.getValue(att)) + separator);
    }
 else {
      builder.append(assignment.getValue(att) + separator);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + att.getStateSpaceType().getStateSpaceTypeEnum());
  }
  return builder.toString();
}
Program: 21277
Project: 21277
Buggy source:
/** 
 * Initialises the class for concept drift detection.
 */
public void initLearning(){
  if (classIndex == -1)   classIndex=attributes.getNumberOfAttributes() - 1;
switch (this.conceptDriftDetector) {
case GLOBAL:
    this.buildGlobalDAG();
  break;
}
svb=new ParallelVB();
svb.setSeed(this.seed);
svb.setPlateuStructure(new PlateuStructure(hiddenVars));
GaussianHiddenTransitionMethod gaussianHiddenTransitionMethod=new GaussianHiddenTransitionMethod(hiddenVars,0,this.transitionVariance);
gaussianHiddenTransitionMethod.setFading(1.0);
svb.setTransitionMethod(gaussianHiddenTransitionMethod);
svb.setBatchSize(this.batchSize);
svb.setDAG(globalDAG);
svb.setOutput(false);
svb.setMaximumGlobalIterations(100);
svb.setMaximumLocalIterations(100);
svb.setGlobalThreshold(0.00001);
svb.setLocalThreshold(0.01);
svb.initLearning();
}

Fixed version (ground truth):
/** 
 * Initialises the class for concept drift detection.
 */
public void initLearning(){
  if (classIndex == -1)   classIndex=attributes.getNumberOfAttributes() - 1;
switch (this.conceptDriftDetector) {
case GLOBAL:
    this.buildGlobalDAG();
  break;
}
svb=new ParallelVB();
svb.setSeed(this.seed);
svb.setPlateuStructure(new PlateuStructure(hiddenVars));
GaussianHiddenTransitionMethod gaussianHiddenTransitionMethod=new GaussianHiddenTransitionMethod(hiddenVars,0,this.transitionVariance);
gaussianHiddenTransitionMethod.setFading(1.0);
svb.setTransitionMethod(gaussianHiddenTransitionMethod);
svb.setBatchSize(this.batchSize);
svb.setDAG(globalDAG);
svb.setOutput(false);
svb.setMaximumGlobalIterations(100);
svb.setMaximumLocalIterations(100);
svb.setGlobalThreshold(0.01);
svb.setLocalThreshold(0.01);
svb.initLearning();
}
Program: 21278
Project: 21278
Buggy source:
@Override public CompoundVector map(DataOnMemory<DataInstance> dataBatch) throws Exception {
  if (dataBatch.getNumberOfDataInstances() == 0) {
    elbo.aggregate(basedELBO);
    return prior;
  }
 else {
    SVB.BatchOutput out=svb.updateModelOnBatchParallel(dataBatch);
    if (Double.isNaN(out.getElbo()))     throw new IllegalStateException("String_Node_Str");
    elbo.aggregate(svb.getPlateuStructure().getReplicatedNodes().filter(node -> node.isActive()).mapToDouble(node -> svb.getPlateuStructure().getVMP().computeELBO(node)).sum());
    return out.getVector();
  }
}

Fixed version (ground truth):
@Override public CompoundVector map(DataOnMemory<DataInstance> dataBatch) throws Exception {
  if (dataBatch.getNumberOfDataInstances() == 0) {
    elbo.aggregate(basedELBO);
    return prior;
  }
 else {
    this.svb.updateNaturalParameterPrior(updatedPrior);
    this.svb.updateNaturalParameterPosteriors(updatedPrior);
    svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(false));
    SVB.BatchOutput out=svb.updateModelOnBatchParallel(dataBatch);
    if (Double.isNaN(out.getElbo()))     throw new IllegalStateException("String_Node_Str");
    elbo.aggregate(out.getElbo());
    svb.getPlateuStructure().getNonReplictedNodes().forEach(node -> node.setActive(true));
    if (partialVectors.containsKey(dataBatch.getBatchID())) {
      CompoundVector newVector=Serialization.deepCopy(updatedPrior);
      newVector.substract(partialVectors.get(dataBatch.getBatchID()));
      this.svb.updateNaturalParameterPrior(newVector);
      this.svb.updateNaturalParameterPosteriors(newVector);
    }
 else {
      this.svb.updateNaturalParameterPrior(this.prior);
      this.svb.getPlateuStructure().setSeed(this.svb.getSeed());
      this.svb.getPlateuStructure().resetQs();
    }
    out=svb.updateModelOnBatchParallel(dataBatch);
    partialVectors.put(dataBatch.getBatchID(),out.getVector());
    return out.getVector();
  }
}
Program: 21279
Project: 21279
Buggy source:
@Override public boolean isConverged(int iteration,DoubleValue value){
  if (Double.isNaN(value.getValue()))   throw new IllegalStateException("String_Node_Str");
  double percentage=100 * (value.getValue() - previousELBO) / Math.abs(previousELBO);
  if (iteration == 1) {
    previousELBO=value.getValue();
    logger.info("String_Node_Str",iteration,100,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ 100+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    return false;
  }
 else   if (percentage < 0 && percentage < -threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return true;
  }
 else   if (percentage > 0 && percentage > threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else {
    logger.info("String_Node_Str",iteration,percentage,value.getValue());
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ value.getValue());
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isConverged(int iteration,DoubleValue value){
  if (Double.isNaN(value.getValue()))   throw new IllegalStateException("String_Node_Str");
  if (value.getValue() == Double.NEGATIVE_INFINITY)   value.setValue(-Double.MAX_VALUE);
  double percentage=100 * (value.getValue() - previousELBO) / Math.abs(previousELBO);
  if (iteration == 1) {
    previousELBO=value.getValue();
    logger.info("String_Node_Str",iteration,100,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ 100+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    return false;
  }
 else   if (percentage < 0 && percentage < -threshold) {
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else   if (percentage > 0 && percentage > threshold) {
    logger.info("String_Node_Str",iteration,percentage,value.getValue(),previousELBO);
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ (value.getValue() + "String_Node_Str" + previousELBO));
    this.previousELBO=value.getValue();
    return false;
  }
 else {
    logger.info("String_Node_Str",iteration,percentage,value.getValue());
    System.out.println("String_Node_Str" + iteration + "String_Node_Str"+ percentage+ "String_Node_Str"+ value.getValue());
    return true;
  }
}
Program: 21280
Project: 21280
Buggy source:
@Override public void mapPartition(Iterable<T> values,Collector<DataOnMemory<T>> out) throws Exception {
  int count=0;
  DataOnMemoryListContainer<T> batch=new DataOnMemoryListContainer<T>(this.attributes);
  for (  T value : values) {
    if (count < batchSize) {
      batch.add(value);
      count++;
    }
 else {
      out.collect(batch);
      batch=new DataOnMemoryListContainer<T>(this.attributes);
      batch.add(value);
      count=1;
    }
  }
  if (batch.getNumberOfDataInstances() > 0)   out.collect(batch);
}

Fixed version (ground truth):
@Override public void mapPartition(Iterable<T> values,Collector<DataOnMemory<T>> out) throws Exception {
  int index=this.getRuntimeContext().getIndexOfThisSubtask() * 100000;
  int batchCount=0;
  int count=0;
  DataOnMemoryListContainer<T> batch=new DataOnMemoryListContainer<T>(this.attributes);
  for (  T value : values) {
    if (count < batchSize) {
      batch.add(value);
      count++;
    }
 else {
      batch.setId(batchCount + index);
      out.collect(batch);
      batch=new DataOnMemoryListContainer<T>(this.attributes);
      batch.add(value);
      count=1;
      batchCount++;
    }
  }
  if (batch.getNumberOfDataInstances() > 0) {
    batch.setId(batchCount + index);
    out.collect(batch);
  }
}
Program: 21281
Project: 21281
Buggy source:
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_Normal prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.getNaturalParameters().set(0,precisionPrior * meanPrior);
    prior.getNaturalParameters().set(1,-0.5 * precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}
Program: 21282
Project: 21282
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void fixNumericalInstability(){
  double alpha=this.naturalParameters.get(0) + 1;
  double beta=-this.naturalParameters.get(1);
  if ((alpha / beta) > PRECISION_LIMIT) {
    double K=(alpha / beta) / PRECISION_LIMIT;
    double alphaPrime=alpha / K;
    this.naturalParameters.set(0,alphaPrime - 1);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void fixNumericalInstability(){
}
Program: 21283
Project: 21283
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public NaturalParameters getExpectedNaturalToParent(Variable parent,Map<Variable,MomentParameters> momentChildCoParents){
  NaturalParameters naturalParameters=new ArrayVector(2);
  double X=momentChildCoParents.get(var).get(0);
  if (meanParameterVariable == parent) {
    double invVariance=momentChildCoParents.get(gammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double XSquare=momentChildCoParents.get(var).get(1);
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    double meanSquare=momentChildCoParents.get(meanParameterVariable).get(1);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * (XSquare - 2 * X * mean + meanSquare));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public NaturalParameters getExpectedNaturalToParent(Variable parent,Map<Variable,MomentParameters> momentChildCoParents){
  NaturalParameters naturalParameters=new ArrayVector(2);
  double X=momentChildCoParents.get(var).get(0);
  if (meanParameterVariable == parent) {
    double invVariance=momentChildCoParents.get(gammaParameterVariable).get(1);
    naturalParameters=new EF_NormalParameter.ArrayVectorParameter(2);
    naturalParameters.set(0,X);
    naturalParameters.set(1,invVariance);
  }
 else {
    double XSquare=momentChildCoParents.get(var).get(1);
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    double meanSquare=momentChildCoParents.get(meanParameterVariable).get(1);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * (XSquare - 2 * X * mean + meanSquare));
  }
  return naturalParameters;
}
Program: 21284
Project: 21284
Buggy source:
@Override public EF_LearningBayesianNetwork transitionModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable localVar : this.localHiddenVars) {
    Normal normalGlobalHiddenPreviousTimeStep=plateuStructure.getEFParameterPosterior(localVar).toUnivariateDistribution();
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double variance=normalGlobalHiddenPreviousTimeStep.getVariance() + this.transtionVariance;
    double mean=normalGlobalHiddenPreviousTimeStep.getMean();
    normal.getNaturalParameters().set(0,mean / (variance));
    normal.getNaturalParameters().set(1,-1 / (2 * variance));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  if (fading < 1.0) {
    bayesianNetwork.getParametersVariables().getListOfParamaterVariables().stream().forEach(var -> {
      EF_BaseDistribution_MultinomialParents dist=bayesianNetwork.getDistribution(var);
      EF_UnivariateDistribution prior=dist.getBaseEFUnivariateDistribution(0);
      NaturalParameters naturalParameters=prior.getNaturalParameters();
      naturalParameters.multiplyBy(fading);
      prior.setNaturalParameters(naturalParameters);
      dist.setBaseEFDistribution(0,prior);
    }
);
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork transitionModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable localVar : this.localHiddenVars) {
    Normal normalGlobalHiddenPreviousTimeStep=plateuStructure.getEFParameterPosterior(localVar).toUnivariateDistribution();
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double variance=normalGlobalHiddenPreviousTimeStep.getVariance() + this.transtionVariance;
    double mean=normalGlobalHiddenPreviousTimeStep.getMean();
    normal.setNaturalWithMeanPrecision(mean,1 / variance);
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  if (fading < 1.0) {
    bayesianNetwork.getParametersVariables().getListOfParamaterVariables().stream().forEach(var -> {
      EF_BaseDistribution_MultinomialParents dist=bayesianNetwork.getDistribution(var);
      EF_UnivariateDistribution prior=dist.getBaseEFUnivariateDistribution(0);
      NaturalParameters naturalParameters=prior.getNaturalParameters();
      naturalParameters.multiplyBy(fading);
      prior.setNaturalParameters(naturalParameters);
      dist.setBaseEFDistribution(0,prior);
    }
);
  }
  return bayesianNetwork;
}
Program: 21285
Project: 21285
Buggy source:
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.setNaturalWithMeanPrecision(mean,1 / var);
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}
Program: 21286
Project: 21286
Buggy source:
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_Normal prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.getNaturalParameters().set(0,precisionPrior * meanPrior);
    prior.getNaturalParameters().set(1,-0.5 * precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}
Program: 21287
Project: 21287
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void fixNumericalInstability(){
  double alpha=this.naturalParameters.get(0) + 1;
  double beta=-this.naturalParameters.get(1);
  if ((alpha / beta) > PRECISION_LIMIT) {
    double K=(alpha / beta) / PRECISION_LIMIT;
    double alphaPrime=alpha / K;
    this.naturalParameters.set(0,alphaPrime - 1);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void fixNumericalInstability(){
}
Program: 21288
Project: 21288
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public NaturalParameters getExpectedNaturalToParent(Variable parent,Map<Variable,MomentParameters> momentChildCoParents){
  NaturalParameters naturalParameters=new ArrayVector(2);
  double X=momentChildCoParents.get(var).get(0);
  if (meanParameterVariable == parent) {
    double invVariance=momentChildCoParents.get(gammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double XSquare=momentChildCoParents.get(var).get(1);
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    double meanSquare=momentChildCoParents.get(meanParameterVariable).get(1);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * (XSquare - 2 * X * mean + meanSquare));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public NaturalParameters getExpectedNaturalToParent(Variable parent,Map<Variable,MomentParameters> momentChildCoParents){
  NaturalParameters naturalParameters=new ArrayVector(2);
  double X=momentChildCoParents.get(var).get(0);
  if (meanParameterVariable == parent) {
    double invVariance=momentChildCoParents.get(gammaParameterVariable).get(1);
    naturalParameters=new EF_NormalParameter.ArrayVectorParameter(2);
    naturalParameters.set(0,X);
    naturalParameters.set(1,invVariance);
  }
 else {
    double XSquare=momentChildCoParents.get(var).get(1);
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    double meanSquare=momentChildCoParents.get(meanParameterVariable).get(1);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * (XSquare - 2 * X * mean + meanSquare));
  }
  return naturalParameters;
}
Program: 21289
Project: 21289
Buggy source:
@Override public EF_LearningBayesianNetwork transitionModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable localVar : this.localHiddenVars) {
    Normal normalGlobalHiddenPreviousTimeStep=plateuStructure.getEFParameterPosterior(localVar).toUnivariateDistribution();
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double variance=normalGlobalHiddenPreviousTimeStep.getVariance() + this.transtionVariance;
    double mean=normalGlobalHiddenPreviousTimeStep.getMean();
    normal.getNaturalParameters().set(0,mean / (variance));
    normal.getNaturalParameters().set(1,-1 / (2 * variance));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  if (fading < 1.0) {
    bayesianNetwork.getParametersVariables().getListOfParamaterVariables().stream().forEach(var -> {
      EF_BaseDistribution_MultinomialParents dist=bayesianNetwork.getDistribution(var);
      EF_UnivariateDistribution prior=dist.getBaseEFUnivariateDistribution(0);
      NaturalParameters naturalParameters=prior.getNaturalParameters();
      naturalParameters.multiplyBy(fading);
      prior.setNaturalParameters(naturalParameters);
      dist.setBaseEFDistribution(0,prior);
    }
);
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork transitionModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable localVar : this.localHiddenVars) {
    Normal normalGlobalHiddenPreviousTimeStep=plateuStructure.getEFParameterPosterior(localVar).toUnivariateDistribution();
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double variance=normalGlobalHiddenPreviousTimeStep.getVariance() + this.transtionVariance;
    double mean=normalGlobalHiddenPreviousTimeStep.getMean();
    normal.setNaturalWithMeanPrecision(mean,1 / variance);
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  if (fading < 1.0) {
    bayesianNetwork.getParametersVariables().getListOfParamaterVariables().stream().forEach(var -> {
      EF_BaseDistribution_MultinomialParents dist=bayesianNetwork.getDistribution(var);
      EF_UnivariateDistribution prior=dist.getBaseEFUnivariateDistribution(0);
      NaturalParameters naturalParameters=prior.getNaturalParameters();
      naturalParameters.multiplyBy(fading);
      prior.setNaturalParameters(naturalParameters);
      dist.setBaseEFDistribution(0,prior);
    }
);
  }
  return bayesianNetwork;
}
Program: 21290
Project: 21290
Buggy source:
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.getNaturalParameters().set(0,mean / (var));
    normal.getNaturalParameters().set(1,-1 / (2 * var));
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}

Fixed version (ground truth):
@Override public EF_LearningBayesianNetwork initModel(EF_LearningBayesianNetwork bayesianNetwork,PlateuStructure plateuStructure){
  for (  Variable paramVariable : bayesianNetwork.getParametersVariables().getListOfParamaterVariables()) {
    if (!paramVariable.isNormalParameter())     continue;
    EF_NormalParameter prior=bayesianNetwork.getDistribution(paramVariable);
    double varPrior=1;
    double precisionPrior=1 / varPrior;
    double meanPrior=0;
    prior.setNaturalWithMeanPrecision(meanPrior,precisionPrior);
    prior.fixNumericalInstability();
    prior.updateMomentFromNaturalParameters();
  }
  for (  Variable localVar : this.localHiddenVars) {
    EF_Normal normal=bayesianNetwork.getDistribution(localVar);
    double mean=meanStart;
    double var=1;
    normal.setNaturalWithMeanPrecision(mean,1 / var);
    normal.fixNumericalInstability();
    normal.updateMomentFromNaturalParameters();
  }
  return bayesianNetwork;
}
Program: 21291
Project: 21291
Buggy source:
@Override public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  String bnName=parameters.getString(eu.amidst.flinklink.core.learning.parametric.ParallelVB.BN_NAME,"String_Node_Str");
  svb=Serialization.deserializeObject(parameters.getBytes(eu.amidst.flinklink.core.learning.parametric.ParallelVB.SVB,null));
  Collection<CompoundVector> collection=getRuntimeContext().getBroadcastVariable("String_Node_Str" + bnName);
  CompoundVector updatedPrior=collection.iterator().next();
  svb.updateNaturalParameterPrior(updatedPrior);
  List<String> names=Serialization.deserializeObject(parameters.getBytes(LATENT_INTERFACE_VARIABLE_NAMES,null));
  latentInterfaceVariables=names.stream().map(name -> svb.getDAG().getVariables().getVariableByName(name)).collect(Collectors.toList());
  elbo=getIterationRuntimeContext().getIterationAggregator("String_Node_Str" + bnName);
}

Fixed version (ground truth):
@Override public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  String bnName=parameters.getString(eu.amidst.flinklink.core.learning.parametric.ParallelVB.BN_NAME,"String_Node_Str");
  svb=Serialization.deserializeObject(parameters.getBytes(eu.amidst.flinklink.core.learning.parametric.ParallelVB.SVB,null));
  svb.initLearning();
  Collection<CompoundVector> collection=getRuntimeContext().getBroadcastVariable("String_Node_Str" + bnName);
  CompoundVector updatedPrior=collection.iterator().next();
  svb.updateNaturalParameterPrior(updatedPrior);
  List<String> names=Serialization.deserializeObject(parameters.getBytes(LATENT_INTERFACE_VARIABLE_NAMES,null));
  latentInterfaceVariables=names.stream().map(name -> svb.getDAG().getVariables().getVariableByName(name)).collect(Collectors.toList());
  elbo=getIterationRuntimeContext().getIterationAggregator("String_Node_Str" + bnName);
}
Program: 21293
Project: 21293
Buggy source:
@Override public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  svb=Serialization.deserializeObject(parameters.getBytes(SVB,null));
  latentVariables=Serialization.deserializeObject(parameters.getBytes(LATENT_VARS,null));
}

Fixed version (ground truth):
@Override public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  svb=Serialization.deserializeObject(parameters.getBytes(SVB,null));
  svb.initLearning();
  latentVariables=Serialization.deserializeObject(parameters.getBytes(LATENT_VARS,null));
}