Package org.nlpub.watset.eval
Class Pairwise<V>
- java.lang.Object
-
- org.nlpub.watset.eval.Pairwise<V>
-
- Type Parameters:
V- the type of cluster elements
public class Pairwise<V> extends Object
Pairwise precision, recall, and F-score for cluster evaluation.
-
-
Constructor Summary
Constructors Constructor Description Pairwise()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> Stream<org.jgrapht.alg.util.Pair<V,V>>combination(Collection<V> cluster)Return a stream of pairs generated as 2-combinations of the cluster elements.PrecisionRecallevaluate(Collection<Collection<V>> clusters, Collection<Collection<V>> classes)Compute a pairwise precision, recall, and F-score.static <V> org.jgrapht.alg.util.Pair<V,V>pairOf(V first, V second)Create a pair of elements ordered by hashCode.static <V> Set<org.jgrapht.alg.util.Pair<V,V>>transform(Collection<Collection<V>> clusters)Transform a collection of clusters to a collection of pairs generated using 2-combinations of the cluster elements.
-
-
-
Method Detail
-
transform
public static <V> Set<org.jgrapht.alg.util.Pair<V,V>> transform(Collection<Collection<V>> clusters)
Transform a collection of clusters to a collection of pairs generated using 2-combinations of the cluster elements.- Type Parameters:
V- the type of cluster elements- Parameters:
clusters- the collection of clusters- Returns:
- a collection of pairs
-
combination
public static <V> Stream<org.jgrapht.alg.util.Pair<V,V>> combination(Collection<V> cluster)
Return a stream of pairs generated as 2-combinations of the cluster elements.- Type Parameters:
V- the type of cluster elements- Parameters:
cluster- the cluster- Returns:
- a stream of 2-combinations
-
pairOf
public static <V> org.jgrapht.alg.util.Pair<V,V> pairOf(V first, V second)Create a pair of elements ordered by hashCode.- Type Parameters:
V- the type of objects- Parameters:
first- the first objectsecond- the second object- Returns:
- a pair
-
evaluate
public PrecisionRecall evaluate(Collection<Collection<V>> clusters, Collection<Collection<V>> classes)
Compute a pairwise precision, recall, and F-score.- Parameters:
clusters- the collection of the clusters to evaluateclasses- the collection of the gold standard clusters- Returns:
- precision and recalled wrapped in an instance of
PrecisionRecall
-
-