Package org.ddogleg.clustering.kmeans
Class InitializeStandard<P>
java.lang.Object
org.ddogleg.clustering.kmeans.InitializeStandard<P>
- All Implemented Interfaces:
InitializeKMeans<P>
Seeds are selects by randomly picking points. This is the standard way to initialize k-means
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(PointDistance<P> distance, long randomSeed) Initializes internal data structures.Creates a new instance which has the same configuration and can be run in parallel.void
selectSeeds
(LArrayAccessor<P> points, int requestedSeeds, DogArray<P> selectedSeeds) Given the a set of points, select a set of seeds to initialize k-means from.
-
Field Details
-
rand
-
unused
-
used
-
-
Constructor Details
-
InitializeStandard
public InitializeStandard()
-
-
Method Details
-
initialize
Description copied from interface:InitializeKMeans
Initializes internal data structures. Must be called first.- Specified by:
initialize
in interfaceInitializeKMeans<P>
- Parameters:
distance
- Distance function between two pointsrandomSeed
- Seed for any random number generators used internally.
-
selectSeeds
Description copied from interface:InitializeKMeans
Given the a set of points, select a set of seeds to initialize k-means from.
- How duplicate points are handled isn't specified. It could result in two seeds having the same value or the number of selected seeds being less that the requested amount
- If the number of points is less than the number of seeds requested it will at most select one seed for each point
- Specified by:
selectSeeds
in interfaceInitializeKMeans<P>
- Parameters:
points
- (Input) Set of points which is to be clustered.requestedSeeds
- (Input) Number of seeds it will attempt to select. See above for exceptions.selectedSeeds
- (Output) Storage for selected seeds. They will be copied into it.
-
newInstanceThread
Description copied from interface:InitializeKMeans
Creates a new instance which has the same configuration and can be run in parallel. Some components can be shared as long as they are read only and thread safe.- Specified by:
newInstanceThread
in interfaceInitializeKMeans<P>
-