Program: 21358
Project: 21358
Buggy source:
@Test public void testingMLforDBN4() throws IOException, ClassNotFoundException {
  DynamicBayesianNetworkGenerator dbnGenerator=new DynamicBayesianNetworkGenerator();
  dbnGenerator.setNumberOfContinuousVars(2);
  dbnGenerator.setNumberOfDiscreteVars(0);
  dbnGenerator.setNumberOfStates(2);
  DynamicBayesianNetwork dynamicNB=DynamicBayesianNetworkGenerator.generateDynamicNaiveBayes(new Random(1),2,true);
  dynamicNB.randomInitialization(new Random(1));
  Variable classVar=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var1=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var1_interface=dynamicNB.getDynamicDAG().getDynamicVariables().getInterfaceVariableByName("String_Node_Str");
  ConditionalLinearGaussian distContVar1Class0=(ConditionalLinearGaussian)((BaseDistribution_MultinomialParents)dynamicNB.getConditionalDistributionTimeT(var1)).getBaseConditionalDistribution(0);
  distContVar1Class0.setCoeffForParent(var1_interface,1.3);
  ConditionalLinearGaussian distContVar1Class1=(ConditionalLinearGaussian)((BaseDistribution_MultinomialParents)dynamicNB.getConditionalDistributionTimeT(dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str"))).getBaseConditionalDistribution(1);
  distContVar1Class1.setCoeffForParent(var1_interface,-1.3);
  Variable var2=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var2_interface=dynamicNB.getDynamicDAG().getDynamicVariables().getInterfaceVariableByName("String_Node_Str");
  ConditionalLinearGaussian distContVar2Class0=(ConditionalLinearGaussian)((BaseDistribution_MultinomialParents)dynamicNB.getConditionalDistributionTimeT(var2)).getBaseConditionalDistribution(0);
  distContVar2Class0.setCoeffForParent(var2_interface,2.3);
  ConditionalLinearGaussian distContVar2Class1=(ConditionalLinearGaussian)((BaseDistribution_MultinomialParents)dynamicNB.getConditionalDistributionTimeT(var2)).getBaseConditionalDistribution(1);
  distContVar2Class1.setCoeffForParent(var2_interface,-2.3);
  System.out.println(dynamicNB.getDynamicDAG().toString());
  System.out.println(dynamicNB.toString());
  DynamicBayesianNetworkSampler sampler=new DynamicBayesianNetworkSampler(dynamicNB);
  sampler.setSeed(2);
  DataStream<DynamicDataInstance> data=sampler.sampleToDataBase(10000,10);
  MaximumLikelihoodForDBN.setBatchSize(1000);
  MaximumLikelihoodForDBN.setParallelMode(false);
  Stopwatch watch=Stopwatch.createStarted();
  DynamicBayesianNetwork bnet=MaximumLikelihoodForDBN.learnDynamic(dynamicNB.getDynamicDAG(),data);
  System.out.println(watch.stop());
  System.out.println();
  for (  Variable var : dynamicNB.getDynamicVariables()) {
    System.out.println("String_Node_Str" + var.getName() + "String_Node_Str");
    System.out.println("String_Node_Str" + dynamicNB.getConditionalDistributionTimeT(var));
    System.out.println("String_Node_Str" + bnet.getConditionalDistributionTimeT(var));
    Assert.assertTrue(bnet.getConditionalDistributionTimeT(var).equalDist(dynamicNB.getConditionalDistributionTimeT(var),0.5));
  }
}

Fixed version (ground truth):
@Test public void testingMLforDBN4() throws IOException, ClassNotFoundException {
  DynamicBayesianNetworkGenerator dbnGenerator=new DynamicBayesianNetworkGenerator();
  dbnGenerator.setNumberOfContinuousVars(2);
  dbnGenerator.setNumberOfDiscreteVars(0);
  dbnGenerator.setNumberOfStates(2);
  DynamicBayesianNetwork dynamicNB=DynamicBayesianNetworkGenerator.generateDynamicNaiveBayes(new Random(1),2,true);
  dynamicNB.randomInitialization(new Random(1));
  Variable classVar=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var1=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var1_interface=dynamicNB.getDynamicDAG().getDynamicVariables().getInterfaceVariableByName("String_Node_Str");
  ConditionalLinearGaussian distContVar1Class0=((Normal_MultinomialNormalParents)dynamicNB.getConditionalDistributionTimeT(var1)).getNormal_NormalParentsDistribution(0);
  distContVar1Class0.setCoeffForParent(var1_interface,1.3);
  ConditionalLinearGaussian distContVar1Class1=((Normal_MultinomialNormalParents)dynamicNB.getConditionalDistributionTimeT(dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str"))).getNormal_NormalParentsDistribution(1);
  distContVar1Class1.setCoeffForParent(var1_interface,-1.3);
  Variable var2=dynamicNB.getDynamicDAG().getDynamicVariables().getVariableByName("String_Node_Str");
  Variable var2_interface=dynamicNB.getDynamicDAG().getDynamicVariables().getInterfaceVariableByName("String_Node_Str");
  ConditionalLinearGaussian distContVar2Class0=((Normal_MultinomialNormalParents)dynamicNB.getConditionalDistributionTimeT(var2)).getNormal_NormalParentsDistribution(0);
  distContVar2Class0.setCoeffForParent(var2_interface,2.3);
  ConditionalLinearGaussian distContVar2Class1=((Normal_MultinomialNormalParents)dynamicNB.getConditionalDistributionTimeT(var2)).getNormal_NormalParentsDistribution(1);
  distContVar2Class1.setCoeffForParent(var2_interface,-2.3);
  System.out.println(dynamicNB.getDynamicDAG().toString());
  System.out.println(dynamicNB.toString());
  DynamicBayesianNetworkSampler sampler=new DynamicBayesianNetworkSampler(dynamicNB);
  sampler.setSeed(2);
  DataStream<DynamicDataInstance> data=sampler.sampleToDataBase(10000,10);
  MaximumLikelihoodForDBN.setBatchSize(1000);
  MaximumLikelihoodForDBN.setParallelMode(false);
  Stopwatch watch=Stopwatch.createStarted();
  DynamicBayesianNetwork bnet=MaximumLikelihoodForDBN.learnDynamic(dynamicNB.getDynamicDAG(),data);
  System.out.println(watch.stop());
  System.out.println();
  for (  Variable var : dynamicNB.getDynamicVariables()) {
    System.out.println("String_Node_Str" + var.getName() + "String_Node_Str");
    System.out.println("String_Node_Str" + dynamicNB.getConditionalDistributionTimeT(var));
    System.out.println("String_Node_Str" + bnet.getConditionalDistributionTimeT(var));
    Assert.assertTrue(bnet.getConditionalDistributionTimeT(var).equalDist(dynamicNB.getConditionalDistributionTimeT(var),0.5));
  }
}