Package org.ojalgo.data.cluster
Class Point
java.lang.Object
org.ojalgo.data.cluster.Point
- All Implemented Interfaces:
Comparable<Point>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Primarily used when constructing test cases and similar. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncluster
(Collection<Point> input) 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 centroidsint
Converts a list of objects to a list of points using the provided converter to derive the coordinates.double
The sum of the squared differences between the coordinates of this and the other point.boolean
int
hashCode()
static Point
mean
(Collection<Point> points) static Point.Factory
newFactory
(int dimensions) static ClusteringAlgorithm
<Point> newGreedyClusterer
(double distanceThreshold) Greedy algorithm.static ClusteringAlgorithm
<Point> newKMeansClusterer
(int k) Standard k-means clusteringstatic Point
of
(int id, float... coordinates) toString()
-
Field Details
-
coordinates
public final float[] coordinates -
id
public final int id
-
-
Constructor Details
-
Point
Point(int id, float[] coordinates)
-
-
Method Details
-
cluster
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
-
convert
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 convertconverter
- The function to convert the objects to coordinates- Returns:
- A list of points
-
mean
-
newFactory
-
newGreedyClusterer
Greedy algorithm. The distance measurement is the same as for k-means (distance(Point)
) and the threshold must match that. -
newKMeansClusterer
Standard k-means clustering -
of
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Point>
-
distance
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
-
hashCode
public int hashCode() -
toString
-