@CodeReview(reviewer="Justin Basilico", date="2009-06-29", changesNeeded=false, comments="Changed it to not have a default random, otherwise its good.") public class KMeansFactory extends AbstractRandomized implements Factory<ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>>>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUM_CLUSTERS
The default number of clusters is 10.
|
random
Constructor and Description |
---|
KMeansFactory()
Creates a new instance of KMeansFactory
|
KMeansFactory(int numClusters)
Creates a new instance of KMeansFactory.
|
KMeansFactory(int numClusters,
java.util.Random random)
Creates a new instance of KMeansFactory.
|
Modifier and Type | Method and Description |
---|---|
ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> |
create()
Creates a new instance of an object.
|
static ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> |
create(int numClusters,
java.util.Random random)
Creates a new parallelized k-means clustering algorithm for vector data
with the given number of clusters (k) and random number generator.
|
static ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> |
create(int numClusters,
Semimetric<? super Vector> distanceMetric,
java.util.Random random)
Creates a new parallelized k-means clustering algorithm for vector data
with the given number of clusters (k), distance metric, and random
number generator.
|
int |
getNumClusters()
Gets the number of clusters for the algorithm to attempt to create.
|
void |
setNumClusters(int numClusters)
Sets the number of clusters for the algorithm to attempt to create.
|
clone, getRandom, setRandom
public static final int DEFAULT_NUM_CLUSTERS
public KMeansFactory()
public KMeansFactory(int numClusters)
numClusters
- The number of clusters to use.public KMeansFactory(int numClusters, java.util.Random random)
numClusters
- The number of clusters to use.random
- The random number generator.public static ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> create(int numClusters, java.util.Random random)
numClusters
- Number of clusters to use (k).random
- Random number generator. Used in the cluster initialization.public static ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> create(int numClusters, Semimetric<? super Vector> distanceMetric, java.util.Random random)
numClusters
- Number of clusters to use (k).distanceMetric
- The distance metric for vectors to use.random
- Random number generator. Used in the cluster initialization.public ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>> create()
Factory
create
in interface Factory<ParallelizedKMeansClusterer<Vector,CentroidCluster<Vector>>>
public int getNumClusters()
public void setNumClusters(int numClusters)
numClusters
- The number of clusters for the algorithm to attempt to create.