Class FastPAM.Instance

    • Field Detail

      • fastswap

        protected double fastswap
        Tolerance for fast swapping behavior (may perform worse swaps).
    • Constructor Detail

      • Instance

        public Instance​(DistanceQuery<?> distQ,
                        DBIDs ids,
                        WritableIntegerDataStore assignment,
                        double fasttol)
        Constructor.
        Parameters:
        distQ - Distance query
        ids - IDs to process
        assignment - Cluster assignment
        fasttol - Tolerance for fast swapping
    • Method Detail

      • run

        protected double run​(ArrayModifiableDBIDs medoids,
                             int maxiter)
        Run the PAM optimization phase.
        Overrides:
        run in class FastPAM1.Instance
        Parameters:
        medoids - Medoids list
        maxiter -
        Returns:
        final cost
      • findBestSwaps

        protected void findBestSwaps​(DBIDArrayIter m,
                                     ArrayModifiableDBIDs bestids,
                                     double[] best,
                                     double[] cost,
                                     double[] pcost)
        Find the best swaps.
        Parameters:
        m - Medoids
        bestids - Storage for best non-medois
        best - Storage for best cost
        cost - 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:
        computeReassignmentCost in class PAM.Instance
        Parameters:
        h - Current object to swap with the medoid
        mnum - Medoid number to be replaced
        Returns:
        cost