jsat.clustering
Class TRIKMEDS
- java.lang.Object
-
- jsat.clustering.PAM
-
- jsat.clustering.TRIKMEDS
-
- All Implemented Interfaces:
- java.io.Serializable, Clusterer, KClusterer
public class TRIKMEDS extends PAM
This class implements the TRIKMEDS algorithm for PAM clustering. It returns the exact same result that would have been computed by PAM, but uses the triangle inequality to avoid unnecessary distance calculations. Expected runtime is O( n sqrt(n)), but still has worst case complexity O(n2). It also requires that the distance metric used be a valid distance metric.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TRIKMEDS()TRIKMEDS(DistanceMetric dm)TRIKMEDS(DistanceMetric dm, java.util.Random rand)TRIKMEDS(DistanceMetric dm, java.util.Random rand, SeedSelectionMethods.SeedSelection seedSelection)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static intmedoid(boolean parallel, java.util.Collection<java.lang.Integer> indecies, java.util.List<? extends Vec> X, DistanceMetric dm, java.util.List<java.lang.Double> accel)Computes the medoid of a sub-set of datastatic intmedoid(boolean parallel, java.util.List<? extends Vec> X, DistanceMetric dm)Computes the medoid of the datavoidsetDistanceMetric(DistanceMetric dm)Sets the distance metric used by this clustering algorithm-
Methods inherited from class jsat.clustering.PAM
clone, cluster, cluster, cluster, getDistanceMetric, getMaxIterations, getMedoids, getSeedSelection, setMaxIterations, setSeedSelection, setStoreMedoids
-
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
-
TRIKMEDS
public TRIKMEDS(DistanceMetric dm, java.util.Random rand, SeedSelectionMethods.SeedSelection seedSelection)
-
TRIKMEDS
public TRIKMEDS(DistanceMetric dm, java.util.Random rand)
-
TRIKMEDS
public TRIKMEDS(DistanceMetric dm)
-
TRIKMEDS
public TRIKMEDS()
-
-
Method Detail
-
setDistanceMetric
public void setDistanceMetric(DistanceMetric dm)
Description copied from class:PAMSets the distance metric used by this clustering algorithm- Overrides:
setDistanceMetricin classPAM- Parameters:
dm- the distance metric to use
-
medoid
public static int medoid(boolean parallel, java.util.List<? extends Vec> X, DistanceMetric dm)Computes the medoid of the data- Parameters:
parallel- whether or not the computation should be done using multiple coresX- the list of all datadm- the distance metric to get the medoid with respect to- Returns:
- the index of the point in X that is the medoid
-
medoid
public static int medoid(boolean parallel, java.util.Collection<java.lang.Integer> indecies, java.util.List<? extends Vec> X, DistanceMetric dm, java.util.List<java.lang.Double> accel)Computes the medoid of a sub-set of data- Parameters:
parallel- whether or not the computation should be done using multiple coresindecies- the indexes of the points to get the medoid ofX- the list of all datadm- the distance metric to get the medoid with respect toaccel- the acceleration cache for the distance metric- Returns:
- the index value contained within indecies that is the medoid
-
-
DataMelt 3.0 © DataMelt by jWork.ORG