Class GeneralisedKMeans<T>

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

public final class GeneralisedKMeans<T> extends Object implements ClusteringAlgorithm<T>
Contains the outline of the k-means algorithm, but designed for customisation.
  • Works with any type of data
  • Allows for custom distance calculations
  • Allows for custom centroid initialisation and updating
  • Field Details

  • Constructor Details

    • GeneralisedKMeans

      public GeneralisedKMeans(Function<Collection<T>,List<T>> centroidInitialiser, Function<Collection<T>,T> centroidUpdater, ToDoubleBiFunction<T,T> distanceCalculator)
      You have to configure how distances are measured and how centroids are derived.
      Parameters:
      centroidInitialiser - The initialisation function should return a list of k centroids. This function determines 'K'.
      centroidUpdater - The update function should return a new centroid based on a collection of points (the set of items in a cluster).
      distanceCalculator - A function that calculates the distance between two points.
  • Method Details