Example usage for weka.clusterers ClusterEvaluation getLogLikelihood

List of usage examples for weka.clusterers ClusterEvaluation getLogLikelihood

Introduction

In this page you can find the example usage for weka.clusterers ClusterEvaluation getLogLikelihood.

Prototype

public double getLogLikelihood() 

Source Link

Document

Return the log likelihood corresponding to the most recent set of instances clustered.

Usage

From source file:com.actelion.research.orbit.imageAnalysis.imaging.TMAPoints.java

License:Open Source License

private int guessNumClusters(EM clusterer, Instances instances, int start, int end) throws Exception {
    ClusterEvaluation eval = new ClusterEvaluation();
    int bestNum = start;
    double best = Double.POSITIVE_INFINITY;
    double bic;/*  w ww.j av a 2 s .  c o  m*/
    for (int c = start; c <= end; c++) {
        clusterer.setNumClusters(c);
        clusterer.buildClusterer(instances);
        eval.setClusterer(clusterer);
        eval.evaluateClusterer(instances);
        bic = bic(eval.getLogLikelihood(), c, instances.numInstances());
        logger.trace("numCluster " + c + " -> BIC: " + bic);
        if (bic < best) {
            best = bic;
            bestNum = c;
            logger.trace("bestNum: " + bestNum);
        }
    }
    return bestNum;
}