Class Point

java.lang.Object
org.ojalgo.data.cluster.Point
All Implemented Interfaces:
Comparable<Point>

public final class Point extends Object implements Comparable<Point>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Primarily used when constructing test cases and similar.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final float[]
     
    final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Point(int id, float[] coordinates)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<Set<Point>>
    Essentially works like this: Calculate, and store, distances between all the points (to enable statistical analysis, and speed up the following steps) Perform statistical analysis of the distances to determine a suitable distance threshold for greedy clustering Perform greedy clustering to get an initial set of centroids Filter out centroids/clusters corresponding to extremely small clusters (This determines the 'k') Perform k-means clustering to refine the clusters and centroids
    int
     
    static <T> List<Point>
    convert(List<T> input, Function<T,float[]> converter)
    Converts a list of objects to a list of points using the provided converter to derive the coordinates.
    double
    distance(Point other)
    The sum of the squared differences between the coordinates of this and the other point.
    boolean
     
    int
     
    static Point
     
    newFactory(int dimensions)
     
    newGreedyClusterer(double distanceThreshold)
    Greedy algorithm.
    Standard k-means clustering
    static Point
    of(int id, float... coordinates)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • coordinates

      public final float[] coordinates
    • id

      public final int id
  • Constructor Details

    • Point

      Point(int id, float[] coordinates)
  • Method Details

    • cluster

      public static List<Set<Point>> cluster(Collection<Point> input)
      Essentially works like this:
      1. Calculate, and store, distances between all the points (to enable statistical analysis, and speed up the following steps)
      2. Perform statistical analysis of the distances to determine a suitable distance threshold for greedy clustering
      3. Perform greedy clustering to get an initial set of centroids
      4. Filter out centroids/clusters corresponding to extremely small clusters (This determines the 'k')
      5. Perform k-means clustering to refine the clusters and centroids
    • convert

      public static <T> List<Point> convert(List<T> input, Function<T,float[]> converter)
      Converts a list of objects to a list of points using the provided converter to derive the coordinates. There will be one point for each object in the input list, at matching positions. Further the point id will be the index of the object in the input list.
      Type Parameters:
      T - The type of the objects in the input list
      Parameters:
      input - The list of objects to convert
      converter - The function to convert the objects to coordinates
      Returns:
      A list of points
    • mean

      public static Point mean(Collection<Point> points)
    • newFactory

      public static Point.Factory newFactory(int dimensions)
    • newGreedyClusterer

      public static ClusteringAlgorithm<Point> newGreedyClusterer(double distanceThreshold)
      Greedy algorithm. The distance measurement is the same as for k-means (distance(Point)) and the threshold must match that.
    • newKMeansClusterer

      public static ClusteringAlgorithm<Point> newKMeansClusterer(int k)
      Standard k-means clustering
    • of

      public static Point of(int id, float... coordinates)
    • compareTo

      public int compareTo(Point ref)
      Specified by:
      compareTo in interface Comparable<Point>
    • distance

      public double distance(Point other)
      The sum of the squared differences between the coordinates of this and the other point. (Not the Euclidean distance. This is the squared Euclidean distance.)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object