public double[] logJointDensitiesForInstance(Instance inst) throws Exception {
  double[] weights=logDensityPerClusterForInstance(inst);
  double[] priors=clusterPriors();
  for (int i=0; i < weights.length; i++) {
    if (priors[i] > 0) {
      weights[i]+=Math.log(priors[i]);
    }
 else {
      throw new IllegalArgumentException("Cluster empty!");
    }
  }
  return weights;
}

public double [ ] logJointDensitiesForInstance ( Instance inst ) throws Exception { double [ ] weights = logDensityPerClusterForInstance ( inst ) ; double [ ] priors = clusterPriors ( ) ; for ( int i = 0 ; i < weights . length ; i ++ ) { if ( priors [ i ] > 0 ) { weights [ i ] += Math . log ( priors [ i ] ) ; } else { throw new IllegalArgumentException ( "Cluster empty!" ) ; } } return weights ; }
returns the logs of the joint densities for a given instance .
