Class Pairwise<V>

    • Constructor Detail

      • Pairwise

        public Pairwise()
    • Method Detail

      • transform

        public static <V> Set<org.jgrapht.alg.util.Pair<V,​V>> transform​(Collection<? extends 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 object
        second - the second object
        Returns:
        a pair
      • evaluate

        public PrecisionRecall evaluate​(Set<org.jgrapht.alg.util.Pair<V,​V>> clusterPairs,
                                        Set<org.jgrapht.alg.util.Pair<V,​V>> classPairs)
        Compute a pairwise precision, recall, and F-score.
        Parameters:
        clusterPairs - the cluster pairs to evaluate
        classPairs - the gold standard pairs to evaluate
        Returns:
        precision and recalled wrapped in an instance of PrecisionRecall
      • evaluate

        public PrecisionRecall evaluate​(Collection<? extends Collection<V>> clusters,
                                        Collection<? extends Collection<V>> classes)
        Transform the clusters to pairs and compute a pairwise precision, recall, and F-score.
        Parameters:
        clusters - the collection of the clusters to evaluate
        classes - the collection of the gold standard clusters
        Returns:
        precision and recalled wrapped in an instance of PrecisionRecall