Package org.nlpub.watset.eval
Class NormalizedModifiedPurity<V>
java.lang.Object
org.nlpub.watset.eval.NormalizedModifiedPurity<V>
- Type Parameters:
V- the type of cluster elements
- Direct Known Subclasses:
CachedNormalizedModifiedPurity
Normalized modified purity evaluation measure for overlapping clustering.
Please be especially careful with the hashCode and equals methods of the elements.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a normalized modified purity calculator.NormalizedModifiedPurity(boolean normalized, boolean modified) Construct a normalized modified purity calculator that allows turning normalized and/or modified options off. -
Method Summary
Modifier and TypeMethodDescriptiondoubleCompute the fuzzy overlap between two clusters,clusterandklass.static <V> PrecisionRecallevaluate(NormalizedModifiedPurity<V> precision, NormalizedModifiedPurity<V> recall, Collection<Map<V, Double>> clusters, Collection<Map<V, Double>> classes) Compute a precision and recall using purity and inverse purity, correspondingly.normalize(Collection<Map<V, Double>> clusters) Normalize weights of the cluster elements to allow using normalized (modified) purity.doublepurity(Collection<Map<V, Double>> clusters, Collection<Map<V, Double>> classes) Computes the (modified) purity of the given clusters as according to the gold standard clustering, classes.doubleCompute the (modified) cluster score on a defined collection of classes.transform(List<? extends Collection<V>> clusters) Transform a collection of clusters into a collection of weighted cluster elements.
-
Constructor Details
-
NormalizedModifiedPurity
public NormalizedModifiedPurity()Construct a normalized modified purity calculator. -
NormalizedModifiedPurity
public NormalizedModifiedPurity(boolean normalized, boolean modified) Construct a normalized modified purity calculator that allows turning normalized and/or modified options off.- Parameters:
normalized- normalized purity is onmodified- modified purity is on
-
-
Method Details
-
transform
Transform a collection of clusters into a collection of weighted cluster elements.- Type Parameters:
V- the type of cluster elements- Parameters:
clusters- the collection of clusters- Returns:
- a collection of weighted cluster elements
-
normalize
Normalize weights of the cluster elements to allow using normalized (modified) purity.- Type Parameters:
V- the type of cluster elements- Parameters:
clusters- the collection of clusters- Returns:
- a collection of weight-normalized clusters
-
evaluate
public static <V> PrecisionRecall evaluate(NormalizedModifiedPurity<V> precision, NormalizedModifiedPurity<V> recall, Collection<Map<V, Double>> clusters, Collection<Map<V, Double>> classes) Compute a precision and recall using purity and inverse purity, correspondingly.- Type Parameters:
V- the type of cluster elements- Parameters:
precision- the purityrecall- the inverse purityclusters- the collection of the clusters to evaluateclasses- the collection of the gold standard clusters- Returns:
- precision and recalled wrapped in an instance of
PrecisionRecall
-
purity
Computes the (modified) purity of the given clusters as according to the gold standard clustering, classes.- Parameters:
clusters- the collection of the clusters to evaluateclasses- the collection of the gold standard clusters- Returns:
- (modified) purity
- See Also:
-
score
Compute the (modified) cluster score on a defined collection of classes.- Parameters:
cluster- the cluster to evaluateclasses- the collection of the gold standard clusters- Returns:
- cluster score
-
delta
Compute the fuzzy overlap between two clusters,clusterandklass.In case of modified purity the singleton clusters are ignored.
- Parameters:
cluster- the first clusterklass- the second cluster- Returns:
- cluster overlap measure
- See Also:
-