Module ojalgo

Interface ClusteringAlgorithm<T>

  • Type Parameters:
    T - The element type being clustered.
    All Known Implementing Classes:
    AutomaticClusterer, FeatureBasedClusterer, GeneralisedKMeans, GreedyClusterer, GreedyClustering, KMeansClusterer, RandomClustering, SpectralClusterer
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ClusteringAlgorithm<T>
    Strategy interface for clustering algorithms.

    Implementations partition a collection of items into disjoint, non-empty clusters. Each cluster is represented as a Set<T> containing the items assigned to that cluster; the result of cluster(Collection) is a List<Set<T>> with one set per cluster. Unless otherwise stated by a specific implementation, the following apply:

    • Each input item appears in exactly one cluster (no overlap). - The order of clusters and the order of items within a cluster are unspecified.
    • The result contains no empty clusters.
    • Implementations may be deterministic or randomized and may impose additional preconditions on the input.
    Thread-safety: Implementations are not required to be thread-safe.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<java.util.Set<T>> cluster​(java.util.Collection<T> input)
      Partitions the given items into clusters.
    • Method Detail

      • cluster

        java.util.List<java.util.Set<T>> cluster​(java.util.Collection<T> input)
        Partitions the given items into clusters.
        Parameters:
        input - The items to cluster; must not be null. May be empty.
        Returns:
        A list of clusters; each element of the list is a Set<T> representing one cluster and containing its members. Sets are non-empty and pairwise disjoint; ordering is unspecified.
        Throws:
        java.lang.IllegalArgumentException - If implementation-specific preconditions are violated.