public class PAM extends KClustererBase
Modifier and Type | Field and Description |
---|---|
protected DistanceMetric |
dm |
protected int |
iterLimit |
protected int[] |
medoids |
protected Random |
rand |
protected int |
repeats |
protected SeedSelectionMethods.SeedSelection |
seedSelection |
protected boolean |
storeMedoids |
Constructor and Description |
---|
PAM() |
PAM(DistanceMetric dm) |
PAM(DistanceMetric dm,
Random rand) |
PAM(DistanceMetric dm,
Random rand,
SeedSelectionMethods.SeedSelection seedSelection) |
PAM(PAM toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
PAM |
clone() |
protected double |
cluster(DataSet data,
boolean doInit,
int[] medioids,
int[] assignments,
List<Double> cacheAccel)
Performs the actual work of PAM.
|
int[] |
cluster(DataSet dataSet,
ExecutorService threadpool,
int[] designations)
Performs clustering on the given data set.
|
int[] |
cluster(DataSet dataSet,
int[] designations)
Performs clustering on the given data set.
|
int[] |
cluster(DataSet dataSet,
int clusters,
ExecutorService threadpool,
int[] designations) |
int[] |
cluster(DataSet dataSet,
int clusters,
int[] designations) |
int[] |
cluster(DataSet dataSet,
int lowK,
int highK,
ExecutorService threadpool,
int[] designations) |
int[] |
cluster(DataSet dataSet,
int lowK,
int highK,
int[] designations) |
int |
getMaxIterations() |
int[] |
getMedoids()
Returns the raw array of indices that indicate which data point acted as
the center for each cluster.
|
SeedSelectionMethods.SeedSelection |
getSeedSelection() |
void |
setMaxIterations(int iterLimit) |
void |
setSeedSelection(SeedSelectionMethods.SeedSelection seedSelection)
Sets the method of seed selection used by this algorithm
|
void |
setStoreMedoids(boolean storeMedoids)
If set to
true the computed medoids will be stored after clustering
is completed, and can then be retrieved using getMedoids() . |
cluster, cluster, cluster, cluster
cluster, cluster, createClusterListFromAssignmentArray, getDatapointsFromCluster, supportsWeightedData
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cluster, cluster, supportsWeightedData
protected DistanceMetric dm
protected Random rand
protected SeedSelectionMethods.SeedSelection seedSelection
protected int repeats
protected int iterLimit
protected int[] medoids
protected boolean storeMedoids
public PAM(DistanceMetric dm, Random rand, SeedSelectionMethods.SeedSelection seedSelection)
public PAM(DistanceMetric dm, Random rand)
public PAM(DistanceMetric dm)
public PAM()
public PAM(PAM toCopy)
toCopy
- the object to copypublic void setMaxIterations(int iterLimit)
iterLimit
- the maximum number of iterations of the algorithm to performpublic int getMaxIterations()
public void setStoreMedoids(boolean storeMedoids)
true
the computed medoids will be stored after clustering
is completed, and can then be retrieved using getMedoids()
.storeMedoids
- true
if the medoids should be stored for
later, false
to discard them once clustering is complete.public int[] getMedoids()
public void setSeedSelection(SeedSelectionMethods.SeedSelection seedSelection)
seedSelection
- the method of seed selection to usedpublic SeedSelectionMethods.SeedSelection getSeedSelection()
protected double cluster(DataSet data, boolean doInit, int[] medioids, int[] assignments, List<Double> cacheAccel)
data
- the data set to apply PAM todoInit
- true
if the initialization procedure of training the distance metric, initiating its cache, and selecting he seeds, should be done.medioids
- the array to store the indices that get chosen as the medoids. The length of the array indicates how many medoids should be obtained.assignments
- an array of the same length as data, each value indicating what cluster that point belongs to.cacheAccel
- the pre-computed distance acceleration cache. May be null
.public int[] cluster(DataSet dataSet, int[] designations)
Clusterer
dataSet
- the data set to perform clustering ondesignations
- the array which will contain the designated values. The array will be altered and returned by
the function. If null is given, a new array will be created and returned.public int[] cluster(DataSet dataSet, ExecutorService threadpool, int[] designations)
Clusterer
dataSet
- the data set to perform clustering onthreadpool
- a source of threads to run tasksdesignations
- the array which will contain the designated values. The array will be altered and returned by
the function. If null is given, a new array will be created and returned.public int[] cluster(DataSet dataSet, int clusters, ExecutorService threadpool, int[] designations)
public int[] cluster(DataSet dataSet, int clusters, int[] designations)
public int[] cluster(DataSet dataSet, int lowK, int highK, int[] designations)
public PAM clone()
clone
in interface Clusterer
clone
in interface KClusterer
clone
in class KClustererBase
public int[] cluster(DataSet dataSet, int lowK, int highK, ExecutorService threadpool, int[] designations)
Copyright © 2017. All rights reserved.