Class CLIQUEUnit


  • public class CLIQUEUnit
    extends java.lang.Object
    Represents a unit in the CLIQUE algorithm.
    Since:
    0.1
    Author:
    Elke Achtert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean assigned
      Flag that indicates if this unit is already assigned to a cluster.
      private double[] bounds
      The bounding values (min, max) for each dimension.
      private int[] dims
      The dimensions involved in this subspace.
      private ModifiableDBIDs ids
      The ids of the feature vectors this unit contains.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        CLIQUEUnit​(int dim, double min, double max)
      Creates a new one-dimensional unit for the given interval.
      private CLIQUEUnit​(CLIQUEUnit prefix, int newdim, double min, double max, ModifiableDBIDs ids)
      Creates a new k-dimensional unit for the given intervals.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addFeatureVector​(DBIDRef id, NumberVector vector)
      Adds the id of the specified feature vector to this unit, if this unit contains the feature vector.
      private boolean checkDimensions​(CLIQUEUnit other, int e)
      Check that the first e dimensions agree.
      boolean contains​(NumberVector vector)
      Returns true, if the intervals of this unit contain the specified feature vector.
      protected boolean containsLeftNeighbor​(CLIQUEUnit unit, int d)
      Returns true if this unit is the left neighbor of the given unit.
      protected boolean containsRightNeighbor​(CLIQUEUnit unit, int d)
      Returns true if this unit is the right neighbor of the given unit.
      int dimensionality()
      Get the dimensionality of this unit.
      int getDimension​(int i)
      Get the ith dimension constrained.
      DBIDs getIds()
      Returns the ids of the feature vectors this unit contains.
      boolean isAssigned()
      Returns true if this unit is already assigned to a cluster.
      protected CLIQUEUnit join​(CLIQUEUnit other, double all, double tau)
      Joins this unit with the specified unit.
      void markAsAssigned()
      Marks this unit as assigned to a cluster.
      int numberOfFeatureVectors()
      Returns the number of feature vectors this unit contains.
      double selectivity​(double total)
      Returns the selectivity of this unit, which is defined as the fraction of total feature vectors contained in this unit.
      java.lang.String toString()
      Returns a string representation of this unit that contains the intervals of this unit.
      • Methods inherited from class java.lang.Object

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

      • dims

        private int[] dims
        The dimensions involved in this subspace.
      • bounds

        private double[] bounds
        The bounding values (min, max) for each dimension.
      • ids

        private ModifiableDBIDs ids
        The ids of the feature vectors this unit contains.
      • assigned

        private boolean assigned
        Flag that indicates if this unit is already assigned to a cluster.
    • Constructor Detail

      • CLIQUEUnit

        private CLIQUEUnit​(CLIQUEUnit prefix,
                           int newdim,
                           double min,
                           double max,
                           ModifiableDBIDs ids)
        Creates a new k-dimensional unit for the given intervals.
        Parameters:
        prefix - Prefix unit that will be extended by one dimension
        newdim - Additional dimension
        min - Minimum bound
        max - Maximum bound
        ids - the ids of the feature vectors belonging to this unit
      • CLIQUEUnit

        public CLIQUEUnit​(int dim,
                          double min,
                          double max)
        Creates a new one-dimensional unit for the given interval.
        Parameters:
        dim - Dimension
        min - Minimum
        max - MAximum
    • Method Detail

      • dimensionality

        public int dimensionality()
        Get the dimensionality of this unit.
        Returns:
        Number of dimensions constrained.
      • getDimension

        public int getDimension​(int i)
        Get the ith dimension constrained.
        Parameters:
        i - Index
        Returns:
        dimension
      • contains

        public boolean contains​(NumberVector vector)
        Returns true, if the intervals of this unit contain the specified feature vector.
        Parameters:
        vector - the feature vector to be tested for containment
        Returns:
        true, if the intervals of this unit contain the specified feature vector, false otherwise
      • addFeatureVector

        public boolean addFeatureVector​(DBIDRef id,
                                        NumberVector vector)
        Adds the id of the specified feature vector to this unit, if this unit contains the feature vector.
        Parameters:
        id - Vector id
        vector - the feature vector to be added
        Returns:
        true, if this unit contains the specified feature vector, false otherwise
      • numberOfFeatureVectors

        public int numberOfFeatureVectors()
        Returns the number of feature vectors this unit contains.
        Returns:
        the number of feature vectors this unit contains
      • selectivity

        public double selectivity​(double total)
        Returns the selectivity of this unit, which is defined as the fraction of total feature vectors contained in this unit.
        Parameters:
        total - the total number of feature vectors
        Returns:
        the selectivity of this unit
      • containsLeftNeighbor

        protected boolean containsLeftNeighbor​(CLIQUEUnit unit,
                                               int d)
        Returns true if this unit is the left neighbor of the given unit.
        Parameters:
        unit - Reference unit
        d - Current dimension
        Returns:
        true if this unit is the left neighbor of the given unit
      • containsRightNeighbor

        protected boolean containsRightNeighbor​(CLIQUEUnit unit,
                                                int d)
        Returns true if this unit is the right neighbor of the given unit.
        Parameters:
        unit - Reference unit
        d - Current dimension
        Returns:
        true if this unit is the right neighbor of the given unit
      • isAssigned

        public boolean isAssigned()
        Returns true if this unit is already assigned to a cluster.
        Returns:
        true if this unit is already assigned to a cluster, false otherwise.
      • markAsAssigned

        public void markAsAssigned()
        Marks this unit as assigned to a cluster.
      • getIds

        public DBIDs getIds()
        Returns the ids of the feature vectors this unit contains.
        Returns:
        the ids of the feature vectors this unit contains
      • join

        protected CLIQUEUnit join​(CLIQUEUnit other,
                                  double all,
                                  double tau)
        Joins this unit with the specified unit.
        Parameters:
        other - the unit to be joined
        all - the overall number of feature vectors
        tau - the density threshold for the selectivity of a unit
        Returns:
        the joined unit if the selectivity of the join result is equal or greater than tau, null otherwise
      • checkDimensions

        private boolean checkDimensions​(CLIQUEUnit other,
                                        int e)
        Check that the first e dimensions agree.
        Parameters:
        other - Other unit
        e - Number of dimensions to check
        Returns:
        true if the first e dimensions are the same (index and bounds)
      • toString

        public java.lang.String toString()
        Returns a string representation of this unit that contains the intervals of this unit.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this unit