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.Object
Assignment state.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) WritableIntegerDataStore
assignment
Cluster mapping.(package private) DistanceQuery<?>
distQ
Distance function to use.(package private) DBIDs
ids
Ids to process.(package private) ArrayModifiableDBIDs
medoids
Medoids(package private) DBIDArrayMIter
miter
Medoid iterator(package private) WritableDoubleDataStore
nearest
Distance to the nearest medoid of each point.(package private) WritableDoubleDataStore
second
Distance to the second nearest medoid.(package private) WritableIntegerDataStore
secondid
Medoid id of the second closest.
-
Constructor Summary
Constructors Constructor Description Assignment(DistanceQuery<?> distQ, DBIDs ids, int k)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
assignToNearestCluster()
Assign each point to the nearest medoid.protected double
computeCostDifferential(DBIDRef h, int mnum, CLARANS.Assignment scratch)
Compute the reassignment cost, for one swap.protected double
recompute(DBIDRef id, int mnum, double known, int snum, double sknown)
Recompute the assignment of one point.
-
-
-
Field Detail
-
ids
DBIDs ids
Ids to process.
-
distQ
DistanceQuery<?> distQ
Distance function to use.
-
nearest
WritableDoubleDataStore nearest
Distance to the nearest medoid of each point.
-
second
WritableDoubleDataStore second
Distance to the second nearest medoid.
-
assignment
WritableIntegerDataStore assignment
Cluster mapping.
-
secondid
WritableIntegerDataStore secondid
Medoid id of the second closest. Needs some more memory, but saves recomputations in the common case where not much changed.
-
medoids
ArrayModifiableDBIDs medoids
Medoids
-
miter
DBIDArrayMIter miter
Medoid iterator
-
-
Constructor Detail
-
Assignment
public Assignment(DistanceQuery<?> distQ, DBIDs ids, int k)
Constructor.- Parameters:
distQ
- Distance queryids
- IDs to processk
- Number of medoids
-
-
Method Detail
-
computeCostDifferential
protected double computeCostDifferential(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(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
-
-