Class RandomClustering<T>

  • All Implemented Interfaces:
    ClusteringAlgorithm<T>

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

      Fields 
      Modifier and Type Field Description
      private int myK  
      private static java.util.Random RANDOM  
    • Constructor Summary

      Constructors 
      Constructor Description
      RandomClustering​(int k)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.util.List<T> centroids​(java.util.Collection<T> input)  
      java.util.List<java.util.Set<T>> cluster​(java.util.Collection<T> input)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RANDOM

        private static final java.util.Random RANDOM
      • myK

        private final int myK
    • Constructor Detail

      • RandomClustering

        RandomClustering​(int k)
    • Method Detail

      • cluster

        public java.util.List<java.util.Set<T>> cluster​(java.util.Collection<T> input)
        Specified by:
        cluster in interface ClusteringAlgorithm<T>
      • centroids

        java.util.List<T> centroids​(java.util.Collection<T> input)