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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) elki.database.datastore.WritableIntegerDataStore assignment
      Cluster mapping.
      (package private) elki.database.query.distance.DistanceQuery<?> distQ
      Distance function to use.
      (package private) elki.database.ids.DBIDs ids
      Ids to process.
      (package private) elki.database.ids.ArrayModifiableDBIDs medoids
      Medoids
      (package private) elki.database.ids.DBIDArrayMIter miter
      Medoid iterator
      (package private) elki.database.datastore.WritableDoubleDataStore nearest
      Distance to the nearest medoid of each point.
      (package private) elki.database.datastore.WritableDoubleDataStore second
      Distance to the second nearest medoid.
      (package private) elki.database.datastore.WritableIntegerDataStore secondid
      Medoid id of the second closest.
    • Constructor Summary

      Constructors 
      Constructor Description
      Assignment​(elki.database.query.distance.DistanceQuery<?> distQ, elki.database.ids.DBIDs ids, int k)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected double assignToNearestCluster()
      Assign each point to the nearest medoid.
      protected double computeCostDifferential​(elki.database.ids.DBIDRef h, int mnum, CLARANS.Assignment scratch)
      Compute the reassignment cost, for one swap.
      protected double recompute​(elki.database.ids.DBIDRef id, int mnum, double known, int snum, double sknown)
      Recompute the assignment of one point.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ids

        elki.database.ids.DBIDs ids
        Ids to process.
      • distQ

        elki.database.query.distance.DistanceQuery<?> distQ
        Distance function to use.
      • nearest

        elki.database.datastore.WritableDoubleDataStore nearest
        Distance to the nearest medoid of each point.
      • second

        elki.database.datastore.WritableDoubleDataStore second
        Distance to the second nearest medoid.
      • assignment

        elki.database.datastore.WritableIntegerDataStore assignment
        Cluster mapping.
      • secondid

        elki.database.datastore.WritableIntegerDataStore secondid
        Medoid id of the second closest. Needs some more memory, but saves recomputations in the common case where not much changed.
      • medoids

        elki.database.ids.ArrayModifiableDBIDs medoids
        Medoids
      • miter

        elki.database.ids.DBIDArrayMIter miter
        Medoid iterator
    • Constructor Detail

      • Assignment

        public Assignment​(elki.database.query.distance.DistanceQuery<?> distQ,
                          elki.database.ids.DBIDs ids,
                          int k)
        Constructor.
        Parameters:
        distQ - Distance query
        ids - IDs to process
        k - Number of medoids
    • Method Detail

      • computeCostDifferential

        protected double computeCostDifferential​(elki.database.ids.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​(elki.database.ids.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