public BayesIm iterate(){
  double start=System.currentTimeMillis();
  BdeMetricCache bdeMetricCache=new BdeMetricCache(dataSet,bayesPmM0);
  BayesPm bayesPmMnplus1=bayesPmM0;
  BayesPm bayesPmMn;
  double oldBestScore=Double.NEGATIVE_INFINITY;
  int iteration=0;
  TimedIterate ti=new TimedIterate(bdeMetricCache,bayesPmMnplus1,oldBestScore,iteration,start);
  Thread tithread=new Thread(ti);
  tithread.start();
  try {
    tithread.join();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  bayesPmMnplus1=ti.bayesPmMnplus1;
  bayesPmMn=bayesPmMnplus1;
  EmBayesEstimator emBayesEst=new EmBayesEstimator(bayesPmMn,dataSet);
  return emBayesEst.maximization(tolerance);
}

public BayesIm iterate ( ) { double start = System . currentTimeMillis ( ) ; BdeMetricCache bdeMetricCache = new BdeMetricCache ( dataSet , bayesPmM0 ) ; BayesPm bayesPmMnplus1 = bayesPmM0 ; BayesPm bayesPmMn ; double oldBestScore = Double . NEGATIVE_INFINITY ; int iteration = 0 ; TimedIterate ti = new TimedIterate ( bdeMetricCache , bayesPmMnplus1 , oldBestScore , iteration , start ) ; Thread tithread = new Thread ( ti ) ; tithread . start ( ) ; try { tithread . join ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } bayesPmMnplus1 = ti . bayesPmMnplus1 ; bayesPmMn = bayesPmMnplus1 ; EmBayesEstimator emBayesEst = new EmBayesEstimator ( bayesPmMn , dataSet ) ; return emBayesEst . maximization ( tolerance ) ; }
this iterate2 method also uses bdemetriccache but it uses the factorscoremd method which can handle missing data and latent variables . ths method iteratively score models and finds that which contains the graph of the highest scoring model ( via its bayspm ) as well as parameters which yield the best score given the dataset by using the embayesestimator class .
