Package elki.clustering.kmedoids
Class CLARANS.Assignment
- java.lang.Object
-
- elki.clustering.kmedoids.CLARANS.Assignment
-
- Direct Known Subclasses:
FastCLARANS.Assignment
protected static class CLARANS.Assignment extends java.lang.ObjectAssignment state.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) elki.database.datastore.WritableIntegerDataStoreassignmentCluster mapping.(package private) elki.database.query.distance.DistanceQuery<?>distQDistance function to use.(package private) elki.database.ids.DBIDsidsIds to process.(package private) elki.database.ids.ArrayModifiableDBIDsmedoidsMedoids(package private) elki.database.ids.DBIDArrayMItermiterMedoid iterator(package private) elki.database.datastore.WritableDoubleDataStorenearestDistance to the nearest medoid of each point.(package private) elki.database.datastore.WritableDoubleDataStoresecondDistance to the second nearest medoid.(package private) elki.database.datastore.WritableIntegerDataStoresecondidMedoid id of the second closest.
-
Constructor Summary
Constructors Constructor Description Assignment(elki.database.query.distance.DistanceQuery<?> distQ, elki.database.ids.DBIDs ids, int k)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doubleassignToNearestCluster()Assign each point to the nearest medoid.protected doublecomputeCostDifferential(elki.database.ids.DBIDRef h, int mnum, CLARANS.Assignment scratch)Compute the reassignment cost, for one swap.protected doublerecompute(elki.database.ids.DBIDRef id, int mnum, double known, int snum, double sknown)Recompute the assignment of one point.
-
-
-
Field Detail
-
ids
elki.database.ids.DBIDs ids
Ids to process.
-
distQ
elki.database.query.distance.DistanceQuery<?> distQ
Distance function to use.
-
nearest
elki.database.datastore.WritableDoubleDataStore nearest
Distance to the nearest medoid of each point.
-
second
elki.database.datastore.WritableDoubleDataStore second
Distance to the second nearest medoid.
-
assignment
elki.database.datastore.WritableIntegerDataStore assignment
Cluster mapping.
-
secondid
elki.database.datastore.WritableIntegerDataStore secondid
Medoid id of the second closest. Needs some more memory, but saves recomputations in the common case where not much changed.
-
medoids
elki.database.ids.ArrayModifiableDBIDs medoids
Medoids
-
miter
elki.database.ids.DBIDArrayMIter miter
Medoid iterator
-
-
Method Detail
-
computeCostDifferential
protected double computeCostDifferential(elki.database.ids.DBIDRef h, int mnum, CLARANS.Assignment scratch)Compute the reassignment cost, for one swap.- Parameters:
h- Current object to swap with any medoid.mnum- Medoid number to swap with h.scratch- Scratch assignment to fill.- Returns:
- Cost change
-
recompute
protected double recompute(elki.database.ids.DBIDRef id, int mnum, double known, int snum, double sknown)Recompute the assignment of one point.- Parameters:
id- Point idmnum- Medoid number for known distanceknown- Known distance- Returns:
- cost
-
assignToNearestCluster
protected double assignToNearestCluster()
Assign each point to the nearest medoid.- Returns:
- Assignment cost
-
-