private double calcBIC(CentroidClusterModel bestModel){
  double loglike=0;
  int numCenters=bestModel.getNumberOfClusters();
  int numDimensions=bestModel.getCentroidCoordinates(0).length;
  int numParameters=numCenters - 1 + numCenters * numDimensions + numCenters;
  for (  Cluster c : bestModel.getClusters()) {
    int current_id=c.getClusterId();
    loglike+=logLikelihoodEstimate(c,bestModel.getCentroidCoordinates(current_id),bestModel.getClusterAssignments(exampleSet),numCenters);
  }
  loglike-=numParameters / 2.0 * Math.log(examplesize);
  return loglike;
}

private double calcBIC ( CentroidClusterModel bestModel ) { double loglike = 0 ; int numCenters = bestModel . getNumberOfClusters ( ) ; int numDimensions = bestModel . getCentroidCoordinates ( 0 ) . length ; int numParameters = numCenters - 1 + numCenters * numDimensions + numCenters ; for ( Cluster c : bestModel . getClusters ( ) ) { int current_id = c . getClusterId ( ) ; loglike += logLikelihoodEstimate ( c , bestModel . getCentroidCoordinates ( current_id ) , bestModel . getClusterAssignments ( exampleSet ) , numCenters ) ; } loglike -= numParameters / 2.0 * Math . log ( examplesize ) ; return loglike ; }
calculate the bic like in the paper by dan pelleg and andrew moore
