public class HamerlyKMeans extends KMeans
DistanceMetric
used
support DistanceMetric.isSubadditive()
. It uses only O(n) extra
memory. DEFAULT_SEED_SELECTION, dm, MaxIterLimit, means, nearestCentroidDist, rand, saveCentroidDistance, seedSelection, storeMeans
Constructor and Description |
---|
HamerlyKMeans()
Creates a new k-Means object
|
HamerlyKMeans(DistanceMetric dm,
SeedSelectionMethods.SeedSelection seedSelection)
Creates a new k-Means object
|
HamerlyKMeans(DistanceMetric dm,
SeedSelectionMethods.SeedSelection seedSelection,
Random rand)
Creates a new k-Means object
|
HamerlyKMeans(HamerlyKMeans toCopy) |
Modifier and Type | Method and Description |
---|---|
HamerlyKMeans |
clone() |
protected double |
cluster(DataSet dataSet,
List<Double> accelCache,
int k,
List<Vec> means,
int[] assignment,
boolean exactTotal,
ExecutorService threadpool,
boolean returnError,
Vec dataPointWeights)
This is a helper method where the actual cluster is performed.
|
cluster, cluster, cluster, cluster, cluster, cluster, getDistanceMetric, getIterationLimit, getListOfLists, getMeans, getParameter, getParameters, getSeedSelection, setIterationLimit, setSeedSelection, setStoreMeans, supportsWeightedData
cluster, cluster, cluster, cluster
cluster, cluster, createClusterListFromAssignmentArray, getDatapointsFromCluster
public HamerlyKMeans(DistanceMetric dm, SeedSelectionMethods.SeedSelection seedSelection, Random rand)
dm
- the distance metric to use for clusteringseedSelection
- the method of initial seed selectionrand
- the source of randomnes to usepublic HamerlyKMeans(DistanceMetric dm, SeedSelectionMethods.SeedSelection seedSelection)
dm
- the distance metric to use for clusteringseedSelection
- the method of initial seed selectionpublic HamerlyKMeans()
public HamerlyKMeans(HamerlyKMeans toCopy)
protected double cluster(DataSet dataSet, List<Double> accelCache, int k, List<Vec> means, int[] assignment, boolean exactTotal, ExecutorService threadpool, boolean returnError, Vec dataPointWeights)
KMeans
cluster
in class KMeans
dataSet
- The set of data points to perform clustering onaccelCache
- acceleration cache to use, or null
. If
null
, the kmeans code will attempt to create onek
- the number of clustersmeans
- the initial points to use as the means. Its length is the
number of means that will be searched for. These means will be altered,
and should contain deep copies of the points they were drawn from. May be
empty, in which case the list will be filled with some selected meansassignment
- an empty temp space to store the clustering
classifications. Should be the same length as the number of data pointsexactTotal
- determines how the objective function (return value)
will be computed. If true, extra work will be done to compute the exact
distance from each data point to its cluster. If false, an upper bound
approximation will be used. This also impacts the value stored in
KMeans.nearestCentroidDist
threadpool
- the source of threads for parallel computation. If
null, single threaded execution will occurreturnError
- true
is the sum of squared distances should be
returned. false
means any value can be returned.
KMeans.saveCentroidDistance
only applies if this is true
dataPointWeights
- the weight value to use for each data point. If
null, assume each point has equal weight.public HamerlyKMeans clone()
Copyright © 2017. All rights reserved.