Package org.hipparchus.samples
Class ClusterAlgorithmComparison
java.lang.Object
org.hipparchus.samples.ClusterAlgorithmComparison
Plots clustering results for various algorithms and datasets.
Based on
scikit learn.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Plot component.static class
Display frame. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Vector2D
generateNoiseVector
(RandomGenerator randomGenerator, double noise) Generate a random vector.static void
Example entry point.makeBlobs
(int samples, int centers, double clusterStd, double min, double max, boolean shuffle, RandomGenerator random) Make blobs patterns.makeCircles
(int samples, boolean shuffle, double noise, double factor, RandomGenerator random) Make circles patterns.makeMoons
(int samples, boolean shuffle, double noise, RandomGenerator random) Make Moons patterns.makeSobol
(int samples) Make Sobol patterns.static List<DoublePoint>
Normolize points in a rectangular area
-
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 pointsshuffle
- if true, shuffle pointsnoise
- noise to add to points positionfactor
- reduction factor from outer to inner circlerandom
- 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 pointsshuffle
- if true, shuffle pointsnoise
- noise to add to points positionrandom
- 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 pointscenters
- number of centersclusterStd
- standard deviation of clustermin
- range min valuemax
- range max valueshuffle
- if true, shuffle pointsrandom
- generator to use- Returns:
- blobs patterns
-
makeSobol
Make Sobol patterns.- Parameters:
samples
- number of points- Returns:
- Moons patterns
-
generateNoiseVector
Generate a random vector.- Parameters:
randomGenerator
- random generator to usenoise
- 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 pointsminX
- range min value in XmaxX
- range max value in XminY
- range min value in YmaxY
- range max value in Y- Returns:
- normalized points
-
main
Example entry point.- Parameters:
args
- arguments (not used)
-