public BayesIm maximization(double threshhold){
  double distance=Double.MAX_VALUE;
  BayesIm oldBayesIm=estimatedIm;
  BayesIm newBayesIm=null;
  while (Double.isNaN(distance) || distance > threshhold) {
    expectation(oldBayesIm);
    newBayesIm=getEstimatedIm();
    distance=BayesImDistanceFunction.distance(newBayesIm,oldBayesIm);
    oldBayesIm=newBayesIm;
  }
  return newBayesIm;
}

public BayesIm maximization ( double threshhold ) { double distance = Double . MAX_VALUE ; BayesIm oldBayesIm = estimatedIm ; BayesIm newBayesIm = null ; while ( Double . isNaN ( distance ) || distance > threshhold ) { expectation ( oldBayesIm ) ; newBayesIm = getEstimatedIm ( ) ; distance = BayesImDistanceFunction . distance ( newBayesIm , oldBayesIm ) ; oldBayesIm = newBayesIm ; } return newBayesIm ; }
this method iteratively estimates the parameters of the bayes net using the dataset until the parameters don ' t change . that is , the newly estimated parameters are used in the estimate method to produce even more accurate parameters ( with respect to the dataset ) etc . the threshhold is compared to the distance between successive parameter sets and when the change is less than the threshhold , the process is considered to have converged . the distance between successive bayes nets is the euclidean distance between vectors of sequences of their parameters . see the bayesimdistancefunction class for details .
