nus-yam/ex-repair huggingface dataset:
Program: 21431
Project: 21431
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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 mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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;
}
Program: 21432
Project: 21432
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,-0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).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;
}
Program: 21434
Project: 21434
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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 mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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;
}
Program: 21435
Project: 21435
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,-0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).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;
}
Program: 21437
Project: 21437
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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 mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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;
}
Program: 21438
Project: 21438
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,-0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).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;
}
Program: 21440
Project: 21440
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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 mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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;
}
Program: 21441
Project: 21441
Buggy source:
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).get(1);
    naturalParameters.set(0,X * invVariance);
    naturalParameters.set(1,-0.5 * invVariance);
  }
 else {
    double mean=momentChildCoParents.get(meanParameterVariable).get(0);
    naturalParameters.set(0,-0.5);
    naturalParameters.set(1,-0.5 * Math.pow(X - mean,2));
  }
  return naturalParameters;
}

Fixed version (ground truth):
/** 
 * It is the message to one node to its parent @param parent, taking into account the suff. stat. if it is observed or the moment parameters if not, and incorporating the message (with moment param.) received from all co-parents. (Third form EF equations).
 * @param parent
 * @param momentChildCoParents
 * @return
 */
@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(invGammaParameterVariable).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;
}
Program: 21443
Project: 21443
Buggy source:
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      System.out.println(((ContinuousChanceNode)huginNode).getAlpha(0));
      System.out.println(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}
Program: 21444
Project: 21444
Buggy source:
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,long value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState(value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,double value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState((long)value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 21445
Project: 21445
Buggy source:
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().longValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}

Fixed version (ground truth):
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().doubleValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}
Program: 21446
Project: 21446
Buggy source:
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      System.out.println(((ContinuousChanceNode)huginNode).getAlpha(0));
      System.out.println(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}
Program: 21447
Project: 21447
Buggy source:
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,long value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState(value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,double value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState((long)value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 21448
Project: 21448
Buggy source:
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().longValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}

Fixed version (ground truth):
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().doubleValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}
Program: 21449
Project: 21449
Buggy source:
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      System.out.println(((ContinuousChanceNode)huginNode).getAlpha(0));
      System.out.println(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}
Program: 21450
Project: 21450
Buggy source:
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,long value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState(value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,double value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState((long)value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 21451
Project: 21451
Buggy source:
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().longValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}

Fixed version (ground truth):
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().doubleValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}
Program: 21452
Project: 21452
Buggy source:
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override public <E extends UnivariateDistribution>E getPosterior(Variable var){
  try {
    Node huginNode=huginBN.getNodeByName(var.getName());
    if (var.isMultinomial()) {
      Multinomial dist=new Multinomial(var);
      for (int i=0; i < var.getNumberOfStates(); i++) {
        dist.setProbabilityOfState(i,((DiscreteNode)huginNode).getBelief(i));
      }
      return (E)dist;
    }
 else     if (var.isNormal()) {
      Normal dist=new Normal(var);
      dist.setMean(((ContinuousChanceNode)huginNode).getMean());
      System.out.println(((ContinuousChanceNode)huginNode).getAlpha(0));
      System.out.println(((ContinuousChanceNode)huginNode).getMean());
      dist.setSd(Math.sqrt(((ContinuousChanceNode)huginNode).getVariance()));
      return (E)dist;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 catch (  ExceptionHugin exceptionHugin) {
    exceptionHugin.printStackTrace();
  }
  return null;
}
Program: 21453
Project: 21453
Buggy source:
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,long value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState(value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets an evidence to a Hugin variable.
 * @param n the AMIDST variable to be evidenced.
 * @param value the evidenced value.
 * @throws ExceptionHugin
 */
private void setVarEvidence(Variable n,double value) throws ExceptionHugin {
  if (n.isMultinomial()) {
    ((DiscreteNode)huginBN.getNodeByName(n.getName())).selectState((long)value);
  }
 else   if (n.isNormal()) {
    ((ContinuousChanceNode)huginBN.getNodeByName(n.getName())).enterValue(value);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 21454
Project: 21454
Buggy source:
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().longValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}

Fixed version (ground truth):
@Override public void setEvidence(Assignment assignment){
  ((HashMapAssignment)assignment).entrySet().stream().forEach(entry -> {
    try {
      this.setVarEvidence(entry.getKey(),entry.getValue().doubleValue());
    }
 catch (    ExceptionHugin exceptionHugin) {
      exceptionHugin.printStackTrace();
    }
  }
);
}
Program: 21455
Project: 21455
Buggy source:
public void setVariance(double var){
  this.sd=Math.sqrt(sd);
}

Fixed version (ground truth):
public void setVariance(double var){
  this.sd=Math.sqrt(var);
}
Program: 21456
Project: 21456
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21457
Project: 21457
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21458
Project: 21458
Buggy source:
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    System.out.println("String_Node_Str" + cont++);
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}
Program: 21459
Project: 21459
Buggy source:
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(100);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}

Fixed version (ground truth):
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(1000);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}
Program: 21460
Project: 21460
Buggy source:
public void setVariance(double var){
  this.sd=Math.sqrt(sd);
}

Fixed version (ground truth):
public void setVariance(double var){
  this.sd=Math.sqrt(var);
}
Program: 21461
Project: 21461
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21462
Project: 21462
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21463
Project: 21463
Buggy source:
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    System.out.println("String_Node_Str" + cont++);
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}
Program: 21464
Project: 21464
Buggy source:
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(100);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}

Fixed version (ground truth):
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(1000);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}
Program: 21465
Project: 21465
Buggy source:
public void setVariance(double var){
  this.sd=Math.sqrt(sd);
}

Fixed version (ground truth):
public void setVariance(double var){
  this.sd=Math.sqrt(var);
}
Program: 21466
Project: 21466
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21467
Project: 21467
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21468
Project: 21468
Buggy source:
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    System.out.println("String_Node_Str" + cont++);
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}
Program: 21469
Project: 21469
Buggy source:
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(100);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}

Fixed version (ground truth):
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(1000);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}
Program: 21470
Project: 21470
Buggy source:
public void setVariance(double var){
  this.sd=Math.sqrt(sd);
}

Fixed version (ground truth):
public void setVariance(double var){
  this.sd=Math.sqrt(var);
}
Program: 21471
Project: 21471
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_InverseGamma copy=new EF_InverseGamma(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21472
Project: 21472
Buggy source:
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  return copy;
}

Fixed version (ground truth):
@Override public EF_UnivariateDistribution deepCopy(){
  EF_Normal copy=new EF_Normal(this.getVariable());
  copy.getNaturalParameters().copy(this.getNaturalParameters());
  copy.getMomentParameters().copy(this.getMomentParameters());
  return copy;
}
Program: 21473
Project: 21473
Buggy source:
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    System.out.println("String_Node_Str" + cont++);
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void runLearning(){
  int cont=0;
  for (  DataInstance dataInstance : data) {
    this.vmp.setEvidence(dataInstance);
    this.vmp.runInference();
    for (    EF_ConditionalDistribution dist : this.ef_extendedBN.getDistributionList()) {
      if (dist.getVariable().isParameterVariable()) {
        ((EF_BaseDistribution_MultinomialParents)dist).setBaseEFDistribution(0,this.vmp.getEFPosterior(dist.getVariable()).deepCopy());
      }
    }
  }
}
Program: 21474
Project: 21474
Buggy source:
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(100);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}

Fixed version (ground truth):
public static void testGaussian() throws IOException, ClassNotFoundException {
  BayesianNetwork oneNormalVarBN=BayesianNetworkLoader.loadFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  BayesianNetworkSampler sampler=new BayesianNetworkSampler(oneNormalVarBN);
  sampler.setSeed(0);
  sampler.setParallelMode(true);
  DataStream<DataInstance> data=sampler.sampleToDataBase(1000);
  BayesianLearningEngineForBN.setDAG(oneNormalVarBN.getDAG());
  BayesianLearningEngineForBN.setDataStream(data);
  BayesianLearningEngineForBN.runLearning();
  BayesianNetwork learntOneNormalVarBN=BayesianLearningEngineForBN.getLearntBayesianNetwork();
  System.out.println(oneNormalVarBN.toString());
  System.out.println(learntOneNormalVarBN.toString());
  assertTrue(oneNormalVarBN.equalBNs(learntOneNormalVarBN,0.05));
}