V
- vector datatype@Reference(authors="H.-S. Park, C.-H. Jun",title="A simple and fast algorithm for K-medoids clustering",booktitle="Expert Systems with Applications 36(2)",url="https://doi.org/10.1016/j.eswa.2008.01.039",bibkey="DBLP:journals/eswa/ParkJ09") @Reference(authors="A. P. Reynolds, G. Richards, B. de la Iglesia, V. J. Rayward-Smith",title="Clustering Rules: A Comparison of Partitioning and Hierarchical Clustering Algorithms",booktitle="J. Math. Model. Algorithms 5(4)",url="https://doi.org/10.1007/s10852-005-9022-1",bibkey="DBLP:journals/jmma/ReynoldsRIR06") @Alias(value="de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.KMedoidsEM") public class KMedoidsPark<V> extends AbstractDistanceBasedAlgorithm<V,Clustering<MedoidModel>> implements ClusteringAlgorithm<Clustering<MedoidModel>>
In contrast to PAM, which will in each iteration update one medoid with one (arbitrary) non-medoid, this implementation follows the EM pattern. In the expectation step, the best medoid from the cluster members is chosen; in the M-step, the objects are reassigned to their nearest medoid.
This implementation evolved naturally from EM and k-means algorithms, but apparently a similar approach was published by Park and Jun, and also Reynolds et al. discussed this kind of approach before as a side note.
In our experiments, it tends to be much faster than PAM, but also find less good solutions, as the medoids are only chosen from the cluster members. This aligns with findings of Reynolds et al. and can be explained with the requirement of the new medoid to cover the entire cluster.
Reference:
H.-S. Park, C.-H. Jun
A simple and fast algorithm for K-medoids clustering
Expert Systems with Applications 36(2)
A. P. Reynolds, G. Richards, B. de la Iglesia, V. J. Rayward-Smith
Clustering Rules: A Comparison of Partitioning and Hierarchical Clustering
Algorithms
J. Math. Model. Algorithms 5(4)
Modifier and Type | Class and Description |
---|---|
static class |
KMedoidsPark.Parameterizer<V>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
protected KMedoidsInitialization<V> |
initializer
Method to choose initial means.
|
protected int |
k
Holds the value of
KMeans.K_ID . |
private static java.lang.String |
KEY
Key for statistics logging.
|
private static Logging |
LOG
The logger for this class.
|
protected int |
maxiter
Holds the value of
KMeans.MAXITER_ID . |
ALGORITHM_ID
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
KMedoidsPark(DistanceFunction<? super V> distanceFunction,
int k,
int maxiter,
KMedoidsInitialization<V> initializer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected double |
assignToNearestCluster(DBIDArrayIter miter,
double[] dsum,
java.util.List<? extends ModifiableDBIDs> clusters,
DistanceQuery<V> distQ)
Returns a list of clusters.
|
protected int |
currentCluster(java.util.List<? extends ModifiableDBIDs> clusters,
DBIDRef id)
Find the current cluster assignment.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
Clustering<MedoidModel> |
run(Database database,
Relation<V> relation)
Run k-medoids
|
getDistanceFunction
run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
private static final Logging LOG
private static final java.lang.String KEY
protected int k
KMeans.K_ID
.protected int maxiter
KMeans.MAXITER_ID
.protected KMedoidsInitialization<V> initializer
public KMedoidsPark(DistanceFunction<? super V> distanceFunction, int k, int maxiter, KMedoidsInitialization<V> initializer)
distanceFunction
- distance functionk
- k parametermaxiter
- Maxiter parameterinitializer
- Function to generate the initial meanspublic Clustering<MedoidModel> run(Database database, Relation<V> relation)
database
- Databaserelation
- relation to useprotected double assignToNearestCluster(DBIDArrayIter miter, double[] dsum, java.util.List<? extends ModifiableDBIDs> clusters, DistanceQuery<V> distQ)
miter
- Iterator over the medoidsdsum
- Distance sumsclusters
- cluster assignmentdistQ
- distance queryprotected int currentCluster(java.util.List<? extends ModifiableDBIDs> clusters, DBIDRef id)
clusters
- Clustersid
- Current objectpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<Clustering<MedoidModel>>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Clustering<MedoidModel>>
Copyright © 2019 ELKI Development Team. License information.