cc.mallet.cluster
Class GreedyAgglomerativeByDensity

java.lang.Object
  extended by cc.mallet.cluster.Clusterer
      extended by cc.mallet.cluster.KBestClusterer
          extended by cc.mallet.cluster.HillClimbingClusterer
              extended by cc.mallet.cluster.GreedyAgglomerative
                  extended by cc.mallet.cluster.GreedyAgglomerativeByDensity
All Implemented Interfaces:
java.io.Serializable

public class GreedyAgglomerativeByDensity
extends GreedyAgglomerative

Greedily merges Instances until convergence. New merges are scored using NeighborEvaluator. Differs from GreedyAgglomerative in that one cluster is created at a time. That is, nodes are added to a cluster until convergence. Then, a new cluster is created from the remaining nodes. This reduces the number of comparisons from O(n^2) to O(nlg|n|).

Since:
1.0
Version:
1.0
Author:
"Aron Culotta"
See Also:
GreedyAgglomerative, Serialized Form

Field Summary
 
Fields inherited from class cc.mallet.cluster.GreedyAgglomerative
converged, scoreCache, stoppingThreshold
 
Fields inherited from class cc.mallet.cluster.HillClimbingClusterer
evaluator
 
Constructor Summary
GreedyAgglomerativeByDensity(Pipe instancePipe, NeighborEvaluator evaluator, double stoppingThreshold, boolean doPostConvergenceMerges, java.util.Random random)
           
 
Method Summary
 boolean converged(Clustering clustering)
           
 Clustering improveClustering(Clustering clustering)
          For each pair of clusters, calculate the score of the Neighbor that would result from merging the two clusters.
 void reset()
          Reset convergence to false and clear state so a new round of clustering can begin.
 java.lang.String toString()
           
 
Methods inherited from class cc.mallet.cluster.GreedyAgglomerative
getScore, initializeClustering, updateScoreMatrix
 
Methods inherited from class cc.mallet.cluster.HillClimbingClusterer
cluster, cluster, clusterKBest, clusterKBest, getEvaluator
 
Methods inherited from class cc.mallet.cluster.Clusterer
getPipe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GreedyAgglomerativeByDensity

public GreedyAgglomerativeByDensity(Pipe instancePipe,
                                    NeighborEvaluator evaluator,
                                    double stoppingThreshold,
                                    boolean doPostConvergenceMerges,
                                    java.util.Random random)
Parameters:
instancePipe - Pipe for each underying Instance.
evaluator - To score potential merges.
stoppingThreshold - Clustering converges when the evaluator score is below this value.
doPostConvergenceMerges - If true, perform greedy agglomerative clustering on the clusters at the end of convergence. This may alleviate the greediness of the byDensity clustering algorithm.
Method Detail

converged

public boolean converged(Clustering clustering)
Overrides:
converged in class GreedyAgglomerative
Returns:
True if clustering is complete.

reset

public void reset()
Reset convergence to false and clear state so a new round of clustering can begin.

Overrides:
reset in class GreedyAgglomerative

improveClustering

public Clustering improveClustering(Clustering clustering)
Description copied from class: GreedyAgglomerative
For each pair of clusters, calculate the score of the Neighbor that would result from merging the two clusters. Choose the merge that obtains the highest score. If no merge improves score, return original Clustering

Overrides:
improveClustering in class GreedyAgglomerative
Returns:
A modified Clustering.

toString

public java.lang.String toString()
Overrides:
toString in class GreedyAgglomerative