jsat.clustering.hierarchical
Class NNChainHAC
- java.lang.Object
-
- jsat.clustering.hierarchical.NNChainHAC
-
- All Implemented Interfaces:
- java.io.Serializable, Clusterer, KClusterer
public class NNChainHAC extends java.lang.Object implements KClusterer
This class implements Hierarchical Agglomerative Clustering via the Nearest Neighbor Chain approach. This runs in O(n2) time for anyLance Williamsdissimilarity and uses O(n) memory.
This implementation also supports multi-threaded execution. see:- Müllner, D. (2011). Modern hierarchical, agglomerative clustering algorithms. arXiv Preprint arXiv:1109.2378. Retrieved from here
- Murtagh, F., & Contreras, P. (2011). Methods of Hierarchical Clustering. In Data Mining and Knowledge Discovery. Wiley-Interscience.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NNChainHAC()Creates a new NNChainHAC using theWardmethod.NNChainHAC(LanceWilliamsDissimilarity distMeasure)Creates a new NNChainHACNNChainHAC(LanceWilliamsDissimilarity distMeasure, DistanceMetric distance)Creates a new NNChain using the given dissimilarity measure and distance metric.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description NNChainHACclone()int[]cluster(DataSet dataSet, boolean parallel, int[] designations)Performs clustering on the given data set.int[]cluster(DataSet dataSet, int clusters, boolean parallel, int[] designations)int[]cluster(DataSet dataSet, int lowK, int highK, boolean parallel, int[] designations)int[]getClusterDesignations(int[] designations, int clusters)Returns the assignment array for that would have been computed for the previous data set with the desired number of clusters.java.util.List<java.util.List<DataPoint>>getClusterDesignations(int clusters, DataSet data)Returns the assignment array for that would have been computed for the previous data set with the desired number of clusters.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.clustering.KClusterer
cluster, cluster, cluster, cluster, cluster, cluster
-
Methods inherited from interface jsat.clustering.Clusterer
cluster, cluster, cluster, supportsWeightedData
-
-
-
-
Constructor Detail
-
NNChainHAC
public NNChainHAC()
Creates a new NNChainHAC using theWardmethod.
-
NNChainHAC
public NNChainHAC(LanceWilliamsDissimilarity distMeasure)
Creates a new NNChainHAC- Parameters:
distMeasure- the dissimilarity measure to use
-
NNChainHAC
public NNChainHAC(LanceWilliamsDissimilarity distMeasure, DistanceMetric distance)
Creates a new NNChain using the given dissimilarity measure and distance metric. The correctness guarantees may not hold for distances other than theEuclideandistance, which is the norm for Hierarchical Cluster.- Parameters:
distMeasure- the dissimilarity measure to usedistance- the distance metric to use
-
-
Method Detail
-
clone
public NNChainHAC clone()
- Specified by:
clonein interfaceClusterer- Specified by:
clonein interfaceKClusterer- Overrides:
clonein classjava.lang.Object
-
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- 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[]
-
getClusterDesignations
public int[] getClusterDesignations(int[] designations, int clusters)Returns the assignment array for that would have been computed for the previous data set with the desired number of clusters.- Parameters:
designations- the array to store the assignments inclusters- the number of clusters desired- Returns:
- the original array passed in, or null if no data set has been clustered.
- See Also:
#hasStoredClustering()
-
getClusterDesignations
public java.util.List<java.util.List<DataPoint>> getClusterDesignations(int clusters, DataSet data)
Returns the assignment array for that would have been computed for the previous data set with the desired number of clusters.- Parameters:
clusters- the number of clusters desireddata-- Returns:
- the list of data points in each cluster, or null if no data set has been clustered.
- See Also:
#hasStoredClustering()
-
cluster
public int[] cluster(DataSet dataSet, int clusters, boolean parallel, int[] designations)
- Specified by:
clusterin interfaceKClusterer
-
cluster
public int[] cluster(DataSet dataSet, int lowK, int highK, boolean parallel, int[] designations)
- Specified by:
clusterin interfaceKClusterer
-
-
DataMelt 3.0 © DataMelt by jWork.ORG