Package cc.mallet.cluster
Class GreedyAgglomerativeByDensity
- java.lang.Object
-
- cc.mallet.cluster.Clusterer
-
- cc.mallet.cluster.KBestClusterer
-
- cc.mallet.cluster.HillClimbingClusterer
-
- cc.mallet.cluster.GreedyAgglomerative
-
- cc.mallet.cluster.GreedyAgglomerativeByDensity
-
- All Implemented Interfaces:
java.io.Serializable
public class GreedyAgglomerativeByDensity extends GreedyAgglomerative
Greedily merges Instances until convergence. New merges are scored usingNeighborEvaluator
. Differs fromGreedyAgglomerative
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
Constructors Constructor Description GreedyAgglomerativeByDensity(Pipe instancePipe, NeighborEvaluator evaluator, double stoppingThreshold, boolean doPostConvergenceMerges, java.util.Random random)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
converged(Clustering clustering)
Clustering
improveClustering(Clustering clustering)
For each pair of clusters, calculate the score of theNeighbor
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
-
-
-
-
Constructor Detail
-
GreedyAgglomerativeByDensity
public GreedyAgglomerativeByDensity(Pipe instancePipe, NeighborEvaluator evaluator, double stoppingThreshold, boolean doPostConvergenceMerges, java.util.Random random)
- Parameters:
instancePipe
- Pipe for each underyingInstance
.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 classGreedyAgglomerative
- 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 classGreedyAgglomerative
-
improveClustering
public Clustering improveClustering(Clustering clustering)
Description copied from class:GreedyAgglomerative
For each pair of clusters, calculate the score of theNeighbor
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 classGreedyAgglomerative
- Returns:
- A modified Clustering.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classGreedyAgglomerative
-
-