Class PAM.Instance

  • Direct Known Subclasses:
    EagerPAM.Instance, FastPAM1.Instance, ReynoldsPAM.Instance
    Enclosing class:
    PAM<O>

    protected static class PAM.Instance
    extends java.lang.Object
    Instance for a single dataset.

    Note: we experimented with not caching the distance to nearest and second nearest, but only the assignments. The matrix lookup was more expensive, so this is probably worth the 2*n doubles in storage.

    Author:
    Erich Schubert
    • Constructor Detail

    • Method Detail

      • run

        protected double run​(ArrayModifiableDBIDs medoids,
                             int maxiter)
        Run the PAM optimization phase.
        Parameters:
        medoids - Initial medoids list
        maxiter - Maximum number of iterations
        Returns:
        final cost
      • computeReassignmentCost

        protected double computeReassignmentCost​(DBIDRef h,
                                                 int mnum)
        Compute the reassignment cost of one swap.
        Parameters:
        h - Current object to swap with the medoid
        mnum - Medoid number to be replaced
        Returns:
        cost
      • assignToNearestCluster

        protected double assignToNearestCluster​(ArrayDBIDs means)
        Assign each object to the nearest cluster, return the cost.
        Parameters:
        means - Object centroids
        Returns:
        Assignment cost