nus-yam/ex-repair huggingface dataset:
Program: 21475
Project: 21475
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,-Double.MAX_VALUE);
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,Math.log(THRESHOLD));
 else     if (this.momentParameters.get(i) == 1)     this.naturalParameters.set(i,Math.log(1 - THRESHOLD));
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}
Program: 21476
Project: 21476
Buggy source:
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  bn.randomInitialization(new Random(0));
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}

Fixed version (ground truth):
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}
Program: 21477
Project: 21477
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,-Double.MAX_VALUE);
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,Math.log(THRESHOLD));
 else     if (this.momentParameters.get(i) == 1)     this.naturalParameters.set(i,Math.log(1 - THRESHOLD));
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}
Program: 21478
Project: 21478
Buggy source:
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  bn.randomInitialization(new Random(0));
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}

Fixed version (ground truth):
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}
Program: 21479
Project: 21479
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,-Double.MAX_VALUE);
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,Math.log(THRESHOLD));
 else     if (this.momentParameters.get(i) == 1)     this.naturalParameters.set(i,Math.log(1 - THRESHOLD));
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}
Program: 21480
Project: 21480
Buggy source:
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  bn.randomInitialization(new Random(0));
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}

Fixed version (ground truth):
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}
Program: 21481
Project: 21481
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,-Double.MAX_VALUE);
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  int nstates=var.getNumberOfStates();
  for (int i=0; i < nstates; i++) {
    if (this.momentParameters.get(i) == 0)     this.naturalParameters.set(i,Math.log(THRESHOLD));
 else     if (this.momentParameters.get(i) == 1)     this.naturalParameters.set(i,Math.log(1 - THRESHOLD));
 else     this.naturalParameters.set(i,Math.log(this.momentParameters.get(i)));
  }
}
Program: 21482
Project: 21482
Buggy source:
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  bn.randomInitialization(new Random(0));
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}

Fixed version (ground truth):
public static void main(String[] arguments) throws IOException, ClassNotFoundException {
  BayesianNetwork bn=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(bn.getNumberOfVars());
  System.out.println(bn.getDistributions().stream().mapToInt(p -> p.getNumberOfFreeParameters()).max().getAsInt());
  VMP vmp=new VMP();
  vmp.setParallelMode(true);
  InferenceEngineForBN.setInferenceAlgorithmForBN(vmp);
  double avg=0;
  for (int i=0; i < 20; i++) {
    InferenceEngineForBN.setModel(bn);
    Stopwatch watch=Stopwatch.createStarted();
    InferenceEngineForBN.compileModel();
    System.out.println(watch.stop());
    avg+=watch.elapsed(TimeUnit.MILLISECONDS);
  }
  System.out.println(avg / 20);
  System.out.println(InferenceEngineForBN.getPosterior(bn.getStaticVariables().getVariableById(0)).toString());
}
Program: 21483
Project: 21483
Buggy source:
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=IntStream.range(0,nOfParents + 1).mapToDouble(p -> this.getcovbaseMatrix().getRowVector(p).dotProduct(vec.getcovbaseMatrix().getRowVector(p))).sum();
  return result;
}
Program: 21484
Project: 21484
Buggy source:
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}
Program: 21485
Project: 21485
Buggy source:
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=IntStream.range(0,nOfParents + 1).mapToDouble(p -> this.getcovbaseMatrix().getRowVector(p).dotProduct(vec.getcovbaseMatrix().getRowVector(p))).sum();
  return result;
}
Program: 21486
Project: 21486
Buggy source:
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}
Program: 21487
Project: 21487
Buggy source:
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=IntStream.range(0,nOfParents + 1).mapToDouble(p -> this.getcovbaseMatrix().getRowVector(p).dotProduct(vec.getcovbaseMatrix().getRowVector(p))).sum();
  return result;
}
Program: 21488
Project: 21488
Buggy source:
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}
Program: 21489
Project: 21489
Buggy source:
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=IntStream.range(0,nOfParents + 1).mapToDouble(p -> this.getcovbaseMatrix().getRowVector(p).dotProduct(vec.getcovbaseMatrix().getRowVector(p))).sum();
  return result;
}
Program: 21490
Project: 21490
Buggy source:
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_Normal2NormalParents() throws IOException, ClassNotFoundException {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataBase<StaticDataInstance> data=sampler.sampleToDataBase(100000);
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  HashMapAssignment dataTmp=new HashMapAssignment(3);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  dataTmp.setValue(testnet.getStaticVariables().getVariableByName("String_Node_Str"),1.0);
  System.out.println(testnet.getDistributions().get(2).getLogConditionalProbability(dataTmp));
  System.out.println(ef_testnet.getDistributionList().get(2).computeLogProbabilityOf(dataTmp));
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOf(e);
    assertEquals(logProb,ef_logProb,0.0001);
  }
}
Program: 21491
Project: 21491
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  naturalParameters.setThetaCov_NatParam(theta_Minus1,coeffParents,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21492
Project: 21492
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  double[] theta_beta=Arrays.stream(beta).map(w -> w * variance2Inv).toArray();
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector betaRV=new ArrayRealVector(beta);
  RealMatrix theta_betaBeta=betaRV.outerProduct(betaRV).scalarMultiply(-variance2Inv * 2);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21493
Project: 21493
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  naturalParameters.setThetaCov_NatParam(theta_Minus1,coeffParents,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21494
Project: 21494
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  double[] theta_beta=Arrays.stream(beta).map(w -> w * variance2Inv).toArray();
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector betaRV=new ArrayRealVector(beta);
  RealMatrix theta_betaBeta=betaRV.outerProduct(betaRV).scalarMultiply(-variance2Inv * 2);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21495
Project: 21495
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  naturalParameters.setThetaCov_NatParam(theta_Minus1,coeffParents,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21496
Project: 21496
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  double[] theta_beta=Arrays.stream(beta).map(w -> w * variance2Inv).toArray();
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector betaRV=new ArrayRealVector(beta);
  RealMatrix theta_betaBeta=betaRV.outerProduct(betaRV).scalarMultiply(-variance2Inv * 2);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21497
Project: 21497
Buggy source:
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=0.0;
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=1.0;
  dist.setSd(1.0);
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}
Program: 21498
Project: 21498
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21499
Project: 21499
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21500
Project: 21500
Buggy source:
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=0.0;
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=1.0;
  dist.setSd(1.0);
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}
Program: 21501
Project: 21501
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21502
Project: 21502
Buggy source:
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=0.0;
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}

Fixed version (ground truth):
@Test public void testingProbabilities_NormalNormal1Parent() throws IOException, ClassNotFoundException, ExceptionHugin {
  BayesianNetwork testnet=BayesianNetworkLoader.loadFromHugin("String_Node_Str");
  Normal_NormalParents dist=(Normal_NormalParents)testnet.getDistributions().get(1);
  dist.getCoeffParents()[0]=1.0;
  dist.setSd(1.0);
  System.out.println(testnet.toString());
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(testnet);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  try {
    sampler.sampleToAnARFFFile("String_Node_Str",10);
  }
 catch (  IOException ex) {
  }
  DataBase<StaticDataInstance> data=new StaticDataOnDiskFromFile(new ARFFDataReader(new String("String_Node_Str")));
  EF_BayesianNetwork ef_testnet=new EF_BayesianNetwork(testnet);
  for (  DataInstance e : data) {
    double ef_logProb=0, logProb=0;
    for (    EF_ConditionalDistribution ef_dist : ef_testnet.getDistributionList()) {
      ef_logProb+=ef_dist.computeLogProbabilityOf(e);
    }
    logProb=testnet.getLogProbabiltyOfFullAssignment(e);
    System.out.println("String_Node_Str" + logProb + "String_Node_Str"+ ef_logProb);
    assertEquals(logProb,ef_logProb,0.05);
  }
}