Program: 21416
Project: 21416
Buggy source:
public void trainOnInstanceImplDynamic(Instance inst){
  if (firstInstanceForBatch != null) {
    batch_.add(firstInstanceForBatch);
    count_++;
    firstInstanceForBatch=null;
  }
  DataInstance dataInstance=new DataInstanceImpl(new DataRowWeka(inst));
  if (count_ < windowSize_ && (int)dataInstance.getValue(TIME_ID) == currentTimeID) {
    batch_.add(dataInstance);
    count_++;
  }
 else {
    boolean isNewSeq=false;
    count_=0;
    GaussianHiddenTransitionMethod transitionMethod=nb_.getSvb().getTransitionMethod();
    if ((int)dataInstance.getValue(TIME_ID) == currentTimeID) {
      transitionMethod.setTransitionVariance(0.0);
    }
 else {
      transitionMethod.setTransitionVariance(this.getTransitionVariance_());
      isNewSeq=true;
    }
    firstInstanceForBatch=dataInstance;
    currentTimeID=(int)dataInstance.getValue(TIME_ID);
    double[] stats=computeAccuracyAndAUC(nb_.getLearntBayesianNetwork(),batch_);
    double batchAccuracy=stats[0];
    double batchPRC=stats[1];
    double batchROC=stats[2];
    accPerSeq+=batchAccuracy * batch_.getNumberOfDataInstances();
    prcPerSeq+=batchPRC * batch_.getNumberOfDataInstances();
    rocPerSeq+=batchROC * batch_.getNumberOfDataInstances();
    nbatch+=windowSize_;
    sizePerSeq+=batch_.getNumberOfDataInstances();
    nb_.updateModel(batch_);
    batch_=new DataOnMemoryListContainer(attributes_);
    learntBN_=nb_.getLearntBayesianNetwork();
    for (int i=0; i < nb_.getHiddenVars().size(); i++) {
      Normal normal=nb_.getSvb().getPlateuStructure().getEFVariablePosterior(nb_.getHiddenVars().get(i),0).toUnivariateDistribution();
      meanHiddenVars[i]+=normal.getMean();
    }
    if (isNewSeq) {
      System.out.print(sizePerSeq);
      for (int i=0; i < nb_.getHiddenVars().size(); i++) {
        System.out.print("String_Node_Str" + meanHiddenVars[i]);
        meanHiddenVars[i]=0;
      }
      System.out.print("String_Node_Str" + accPerSeq / sizePerSeq + "String_Node_Str" + prcPerSeq / sizePerSeq + "String_Node_Str" + rocPerSeq / sizePerSeq);
      System.out.println();
      accPerSeq=0.0;
      prcPerSeq=0.0;
      rocPerSeq=0.0;
      sizePerSeq=0;
    }
  }
}

Fixed version (ground truth):
public void trainOnInstanceImplDynamic(Instance inst){
  if (firstInstanceForBatch != null) {
    batch_.add(firstInstanceForBatch);
    count_++;
    firstInstanceForBatch=null;
  }
  DataInstance dataInstance=new DataInstanceImpl(new DataRowWeka(inst));
  if (count_ < windowSize_ && (int)dataInstance.getValue(TIME_ID) == currentTimeID) {
    batch_.add(dataInstance);
    count_++;
  }
 else {
    boolean isNewSeq=false;
    count_=0;
    GaussianHiddenTransitionMethod transitionMethod=nb_.getSvb().getTransitionMethod();
    if ((int)dataInstance.getValue(TIME_ID) == currentTimeID) {
      transitionMethod.setTransitionVariance(0.0);
    }
 else {
      transitionMethod.setTransitionVariance(this.getTransitionVariance_());
      isNewSeq=true;
    }
    firstInstanceForBatch=dataInstance;
    currentTimeID=(int)dataInstance.getValue(TIME_ID);
    double batchAccuracy=computeAccuracyAndRecordPrediction(nb_.getLearntBayesianNetwork(),batch_);
    accPerSeq+=batchAccuracy * batch_.getNumberOfDataInstances();
    nbatch+=windowSize_;
    sizePerSeq+=batch_.getNumberOfDataInstances();
    nb_.updateModel(batch_);
    batch_=new DataOnMemoryListContainer(attributes_);
    learntBN_=nb_.getLearntBayesianNetwork();
    for (int i=0; i < nb_.getHiddenVars().size(); i++) {
      Normal normal=nb_.getSvb().getPlateuStructure().getEFVariablePosterior(nb_.getHiddenVars().get(i),0).toUnivariateDistribution();
      meanHiddenVars[i]+=normal.getMean();
    }
    if (isNewSeq) {
      System.out.print(sizePerSeq);
      ThresholdCurve thresholdCurve=new ThresholdCurve();
      Instances tcurve=thresholdCurve.getCurve(predictions);
      for (int i=0; i < nb_.getHiddenVars().size(); i++) {
        System.out.print("String_Node_Str" + meanHiddenVars[i]);
        meanHiddenVars[i]=0;
      }
      System.out.print("String_Node_Str" + accPerSeq / sizePerSeq + "String_Node_Str" + ThresholdCurve.getPRCArea(tcurve) + "String_Node_Str" + ThresholdCurve.getROCArea(tcurve));
      System.out.println();
      predictions=new ArrayList<>();
      accPerSeq=0.0;
      sizePerSeq=0;
    }
  }
}