Class CLARANS.Assignment

  • Direct Known Subclasses:
    FastCLARANS.Assignment
    Enclosing class:
    CLARANS<O>

    protected static class CLARANS.Assignment
    extends java.lang.Object
    Assignment state.
    Author:
    Erich Schubert
    • Constructor Detail

      • Assignment

        public Assignment​(DistanceQuery<?> distQ,
                          DBIDs ids,
                          int k)
        Constructor.
        Parameters:
        distQ - Distance query
        ids - IDs to process
        k - 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 id
        mnum - Medoid number for known distance
        known - Known distance
        Returns:
        cost
      • assignToNearestCluster

        protected double assignToNearestCluster()
        Assign each point to the nearest medoid.
        Returns:
        Assignment cost