jsat.clustering.kmeans
Class KMeansPDN
- java.lang.Object
-
- jsat.clustering.ClustererBase
-
- jsat.clustering.KClustererBase
-
- jsat.clustering.kmeans.KMeans
-
- jsat.clustering.kmeans.KMeansPDN
-
- All Implemented Interfaces:
- java.io.Serializable, Clusterer, KClusterer, Parameterized
public class KMeansPDN extends KMeans
This class provides a method of performingKMeansclustering when the value ofKis not known. It works by incrementing the value ofkup to some specified maximum, and running a full KMeans for each value.
Note, by default this implementation uses a heuristic for the max value ofKthat is capped at 100 when using theClusterer.cluster(jsat.DataSet)type methods.
When the value ofKis specified, the implementation will simply call the regular KMeans object it was constructed with. See: Pham, D. T., Dimov, S. S.,&Nguyen, C. D. (2005). Selection of K in K-means clustering. Proceedings of the Institution of Mechanical Engineers, Part C: Journal of Mechanical Engineering Science, 219(1), 103–119. doi:10.1243/095440605X8298- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class jsat.clustering.kmeans.KMeans
DEFAULT_SEED_SELECTION
-
-
Constructor Summary
Constructors Constructor and Description KMeansPDN()Creates a new clusterer.KMeansPDN(KMeans kmeans)Creates a new clustered that uses the specified object to perform clustering for allk.KMeansPDN(KMeansPDN toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description KMeansPDNclone()int[]cluster(DataSet dataSet, boolean parallel, int[] designations)Performs clustering on the given data set.int[]cluster(DataSet dataSet, int lowK, int highK, boolean parallel, int[] designations)double[]getfKs()Returns the array off(K)values generated for the last data set.-
Methods inherited from class jsat.clustering.kmeans.KMeans
cluster, cluster, getDistanceMetric, getIterationLimit, getMeans, getSeedSelection, setIterationLimit, setSeedSelection, setStoreMeans, supportsWeightedData
-
Methods inherited from class jsat.clustering.ClustererBase
createClusterListFromAssignmentArray, getDatapointsFromCluster
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
KMeansPDN
public KMeansPDN()
Creates a new clusterer.
-
KMeansPDN
public KMeansPDN(KMeans kmeans)
Creates a new clustered that uses the specified object to perform clustering for allk.- Parameters:
kmeans- the k-means object to use for clustering
-
KMeansPDN
public KMeansPDN(KMeansPDN toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
getfKs
public double[] getfKs()
Returns the array off(K)values generated for the last data set. The value at indexiis the score for clusteri+1. Smaller values indicate better clusterings.- Returns:
- the array of
f(K)values, ornullif no data set has been clustered
-
cluster
public int[] cluster(DataSet dataSet, boolean parallel, int[] designations)
Description copied from interface:ClustererPerforms clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.- Specified by:
clusterin interfaceClusterer- Overrides:
clusterin classKMeans- Parameters:
dataSet- the data set to perform clustering onparallel-trueif multiple threads should be used to perform clustering.falseif it should be done in a single threaded manner.designations- 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.- Returns:
- the int[]
-
cluster
public int[] cluster(DataSet dataSet, int lowK, int highK, boolean parallel, int[] designations)
- Specified by:
clusterin interfaceKClusterer- Overrides:
clusterin classKMeans
-
-
DataMelt 3.0 © DataMelt by jWork.ORG