Class RandomClustering<T>

java.lang.Object
org.ojalgo.data.cluster.RandomClustering<T>
All Implemented Interfaces:
ClusteringAlgorithm<T>

final class RandomClustering<T> extends Object implements ClusteringAlgorithm<T>
Randomly assigns each item to one of k clusters.
  • Field Details

    • RANDOM

      private static final Random RANDOM
    • myK

      private final int myK
  • Constructor Details

    • RandomClustering

      RandomClustering(int k)
  • Method Details

    • cluster

      public List<Set<T>> cluster(Collection<T> input)
      Description copied from interface: ClusteringAlgorithm
      Partitions the given items into clusters.
      Specified by:
      cluster in interface ClusteringAlgorithm<T>
      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.
    • centroids

      List<T> centroids(Collection<T> input)