public class NaiveKMeans extends KMeans
ElkanKMeans
DEFAULT_SEED_SELECTION, dm, MaxIterLimit, means, nearestCentroidDist, rand, saveCentroidDistance, seedSelection, storeMeans
Constructor and Description |
---|
NaiveKMeans()
Creates a new naive k-Means cluster using
k-means++ for the
seed selection and the EuclideanDistance |
NaiveKMeans(DistanceMetric dm)
Creates a new naive k-Means cluster using
k-means++ for the seed selection. |
NaiveKMeans(DistanceMetric dm,
SeedSelectionMethods.SeedSelection seedSelection)
Creates a new naive k-Means cluster
|
NaiveKMeans(DistanceMetric dm,
SeedSelectionMethods.SeedSelection seedSelection,
Random rand)
Creates a new naive k-Means cluster
|
NaiveKMeans(NaiveKMeans toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
NaiveKMeans |
clone() |
protected double |
cluster(DataSet dataSet,
List<Double> accelCacheInit,
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 NaiveKMeans()
k-means++
for the
seed selection and the EuclideanDistance
public NaiveKMeans(DistanceMetric dm)
k-means++
for the seed selection.dm
- the distance function to usepublic NaiveKMeans(DistanceMetric dm, SeedSelectionMethods.SeedSelection seedSelection)
dm
- the distance function to useseedSelection
- the method of selecting the initial seedspublic NaiveKMeans(DistanceMetric dm, SeedSelectionMethods.SeedSelection seedSelection, Random rand)
dm
- the distance function to useseedSelection
- the method of selecting the initial seedsrand
- the source of randomness to usepublic NaiveKMeans(NaiveKMeans toCopy)
toCopy
- the object to copyprotected double cluster(DataSet dataSet, List<Double> accelCacheInit, 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 onaccelCacheInit
- 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 NaiveKMeans clone()
Copyright © 2017. All rights reserved.