Package elki.clustering.kmedoids
Class ReynoldsPAM.Instance
- java.lang.Object
-
- elki.clustering.kmedoids.PAM.Instance
-
- elki.clustering.kmedoids.ReynoldsPAM.Instance
-
- Enclosing class:
- ReynoldsPAM<O>
protected static class ReynoldsPAM.Instance extends PAM.Instance
Instance for a single dataset.- Author:
- Erich Schubert
-
-
Field Summary
-
Fields inherited from class elki.clustering.kmedoids.PAM.Instance
assignment, distQ, ids, nearest, second
-
-
Constructor Summary
Constructors Constructor Description Instance(DistanceQuery<?> distQ, DBIDs ids, WritableIntegerDataStore assignment)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
computeReassignmentCost(DBIDRef h, WritableDoubleDataStore tnearest)
Compute the reassignment cost, for all medoids in one pass.protected double
computeRemovalCost(int i, WritableDoubleDataStore tnearest)
Compute the cost of removing a medoid just once.protected double
run(ArrayModifiableDBIDs medoids, int maxiter)
Run the PAM optimization phase.-
Methods inherited from class elki.clustering.kmedoids.PAM.Instance
assignToNearestCluster, computeReassignmentCost
-
-
-
-
Constructor Detail
-
Instance
public Instance(DistanceQuery<?> distQ, DBIDs ids, WritableIntegerDataStore assignment)
Constructor.- Parameters:
distQ
- Distance queryids
- IDs to processassignment
- Cluster assignment
-
-
Method Detail
-
run
protected double run(ArrayModifiableDBIDs medoids, int maxiter)
Run the PAM optimization phase.- Overrides:
run
in classPAM.Instance
- Parameters:
medoids
- Medoids listmaxiter
-- Returns:
- final cost
-
computeRemovalCost
protected double computeRemovalCost(int i, WritableDoubleDataStore tnearest)
Compute the cost of removing a medoid just once. This can then be reused for every point, thus decreasing the runtime cost at low memory overhead.The output array contains for each medoid the cost of removing all its points, and reassigning them to the second nearest medoid instead.
- Parameters:
i
- Medoid to virtually removetnearest
- Output storage- Returns:
- Cost
-
computeReassignmentCost
protected double computeReassignmentCost(DBIDRef h, WritableDoubleDataStore tnearest)
Compute the reassignment cost, for all medoids in one pass.- Parameters:
h
- Current object to swap with any medoid.tnearest
- Distance to the nearest except the removed medoid- Returns:
- cost change
-
-