Program: 21228
Project: 21228
Buggy source:
@Override public void setDAG(DAG dag){
  if (dag != null)   throw new IllegalStateException("String_Node_Str");
  Variables variables=new Variables();
  word=variables.newSparseMultionomialVariable(attributes.getAttributeByName(wordDocumentName));
  topicIndicator=variables.newMultionomialVariable("String_Node_Str",nTopics);
  dagLDA=new DAG(variables);
  dagLDA.setName("String_Node_Str");
  dagLDA.getParentSet(word).addParent(topicIndicator);
  List<EF_ConditionalDistribution> dists=dagLDA.getParentSets().stream().map(pSet -> pSet.getMainVar().getDistributionType().<EF_ConditionalDistribution>newEFConditionalDistribution(pSet.getParents())).collect(Collectors.toList());
  ef_learningmodel=new EF_LearningBayesianNetwork(dists);
  this.ef_learningmodel.getListOfParametersVariables().stream().forEach(var -> this.replicatedVariables.put(var,false));
  this.ef_learningmodel.getListOfNonParameterVariables().stream().forEach(var -> this.replicatedVariables.put(var,true));
  dirichletMixingTopics=ef_learningmodel.getDistribution(topicIndicator).getConditioningVariables().get(0);
  this.replicatedVariables.put(dirichletMixingTopics,true);
  this.nonReplicatedVariablesList=this.replicatedVariables.entrySet().stream().filter(entry -> !entry.getValue()).map(entry -> entry.getKey()).sorted((a,b) -> a.getVarID() - b.getVarID()).collect(Collectors.toList());
  for (int i=0; i < nTopics; i++) {
    ef_learningmodel.getDistribution(dirichletMixingTopics).getNaturalParameters().set(i,0.1);
  }
  for (  Variable variable : this.nonReplicatedVariablesList) {
    NaturalParameters vec=this.ef_learningmodel.getDistribution(variable).getNaturalParameters();
    for (int i=0; i < vec.size(); i++) {
      vec.set(i,0.01);
    }
  }
}

Fixed version (ground truth):
@Override public void setDAG(DAG dag){
  if (dag != null)   throw new IllegalStateException("String_Node_Str");
  Variables variables=new Variables();
  word=variables.newSparseMultionomialVariable(attributes.getAttributeByName(wordDocumentName));
  topicIndicator=variables.newMultinomialVariable("String_Node_Str",nTopics);
  dagLDA=new DAG(variables);
  dagLDA.setName("String_Node_Str");
  dagLDA.getParentSet(word).addParent(topicIndicator);
  List<EF_ConditionalDistribution> dists=dagLDA.getParentSets().stream().map(pSet -> pSet.getMainVar().getDistributionType().<EF_ConditionalDistribution>newEFConditionalDistribution(pSet.getParents())).collect(Collectors.toList());
  ef_learningmodel=new EF_LearningBayesianNetwork(dists);
  this.ef_learningmodel.getListOfParametersVariables().stream().forEach(var -> this.replicatedVariables.put(var,false));
  this.ef_learningmodel.getListOfNonParameterVariables().stream().forEach(var -> this.replicatedVariables.put(var,true));
  dirichletMixingTopics=ef_learningmodel.getDistribution(topicIndicator).getConditioningVariables().get(0);
  this.replicatedVariables.put(dirichletMixingTopics,true);
  this.nonReplicatedVariablesList=this.replicatedVariables.entrySet().stream().filter(entry -> !entry.getValue()).map(entry -> entry.getKey()).sorted((a,b) -> a.getVarID() - b.getVarID()).collect(Collectors.toList());
  for (int i=0; i < nTopics; i++) {
    ef_learningmodel.getDistribution(dirichletMixingTopics).getNaturalParameters().set(i,0.1);
  }
  for (  Variable variable : this.nonReplicatedVariablesList) {
    NaturalParameters vec=this.ef_learningmodel.getDistribution(variable).getNaturalParameters();
    for (int i=0; i < vec.size(); i++) {
      vec.set(i,0.01);
    }
  }
}