Package elki.clustering.kmedoids
Class FastPAM.Instance
- java.lang.Object
-
- elki.clustering.kmedoids.PAM.Instance
-
- elki.clustering.kmedoids.FastPAM1.Instance
-
- elki.clustering.kmedoids.FastPAM.Instance
-
- Direct Known Subclasses:
FasterPAM.Instance
protected static class FastPAM.Instance extends FastPAM1.Instance
Instance for a single dataset.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected doublefastswapTolerance for fast swapping behavior (may perform worse swaps).-
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, double fasttol)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublecomputeReassignmentCost(DBIDRef h, int mnum)Compute the reassignment cost of one swap.protected voidfindBestSwaps(DBIDArrayIter m, ArrayModifiableDBIDs bestids, double[] best, double[] cost, double[] pcost)Find the best swaps.protected doublerun(ArrayModifiableDBIDs medoids, int maxiter)Run the PAM optimization phase.-
Methods inherited from class elki.clustering.kmedoids.FastPAM1.Instance
assignToNearestCluster, computeReassignmentCost, updateAssignment, updatePriorCost, updateSecondNearest
-
-
-
-
Constructor Detail
-
Instance
public Instance(DistanceQuery<?> distQ, DBIDs ids, WritableIntegerDataStore assignment, double fasttol)
Constructor.- Parameters:
distQ- Distance queryids- IDs to processassignment- Cluster assignmentfasttol- Tolerance for fast swapping
-
-
Method Detail
-
run
protected double run(ArrayModifiableDBIDs medoids, int maxiter)
Run the PAM optimization phase.- Overrides:
runin classFastPAM1.Instance- Parameters:
medoids- Medoids listmaxiter-- Returns:
- final cost
-
findBestSwaps
protected void findBestSwaps(DBIDArrayIter m, ArrayModifiableDBIDs bestids, double[] best, double[] cost, double[] pcost)
Find the best swaps.- Parameters:
m- Medoidsbestids- Storage for best non-medoisbest- Storage for best costcost- Scratch space for cost
-
computeReassignmentCost
protected double computeReassignmentCost(DBIDRef h, int mnum)
Compute the reassignment cost of one swap.This differs from the version in regular PAM by the bit mask operation only.
- Overrides:
computeReassignmentCostin classPAM.Instance- Parameters:
h- Current object to swap with the medoidmnum- Medoid number to be replaced- Returns:
- cost
-
-