Class ClusterAlgorithmComparison

java.lang.Object
org.hipparchus.samples.ClusterAlgorithmComparison

public class ClusterAlgorithmComparison extends Object
Plots clustering results for various algorithms and datasets. Based on scikit learn.
  • Constructor Details

    • ClusterAlgorithmComparison

      public ClusterAlgorithmComparison()
      Empty constructor.

      This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.

      Since:
      3.0
  • Method Details

    • makeCircles

      public static List<Vector2D> makeCircles(int samples, boolean shuffle, double noise, double factor, RandomGenerator random)
      Make circles patterns.
      Parameters:
      samples - number of points
      shuffle - if true, shuffle points
      noise - noise to add to points position
      factor - reduction factor from outer to inner circle
      random - generator to use
      Returns:
      circle patterns
    • makeMoons

      public static List<Vector2D> makeMoons(int samples, boolean shuffle, double noise, RandomGenerator random)
      Make Moons patterns.
      Parameters:
      samples - number of points
      shuffle - if true, shuffle points
      noise - noise to add to points position
      random - generator to use
      Returns:
      Moons patterns
    • makeBlobs

      public static List<Vector2D> makeBlobs(int samples, int centers, double clusterStd, double min, double max, boolean shuffle, RandomGenerator random)
      Make blobs patterns.
      Parameters:
      samples - number of points
      centers - number of centers
      clusterStd - standard deviation of cluster
      min - range min value
      max - range max value
      shuffle - if true, shuffle points
      random - generator to use
      Returns:
      blobs patterns
    • makeSobol

      public static List<Vector2D> makeSobol(int samples)
      Make Sobol patterns.
      Parameters:
      samples - number of points
      Returns:
      Moons patterns
    • generateNoiseVector

      public static Vector2D generateNoiseVector(RandomGenerator randomGenerator, double noise)
      Generate a random vector.
      Parameters:
      randomGenerator - random generator to use
      noise - noise level
      Returns:
      random vector
    • normalize

      public static List<DoublePoint> normalize(List<Vector2D> input, double minX, double maxX, double minY, double maxY)
      Normolize points in a rectangular area
      Parameters:
      input - input points
      minX - range min value in X
      maxX - range max value in X
      minY - range min value in Y
      maxY - range max value in Y
      Returns:
      normalized points
    • main

      public static void main(String[] args)
      Example entry point.
      Parameters:
      args - arguments (not used)