Class DensityGrid

  • All Implemented Interfaces:
    Serializable, MOAObject

    public class DensityGrid
    extends CFCluster
    Density Grids are defined in equation 3 (section 3.1) of Chen and Tu 2007 as: In D-Stream, we partition the d−dimensional space S into density grids. Suppose for each dimension, its space Si, i =1, ··· ,d is divided into pi partitions as Si = Si,1 U Si,2 U ··· U Si,pi (2) then the data space S is partitioned into N = PRODUCT (i=1..d) pi density grids. For a density grid g that is composed of S1,j1 ×S2,j2 ···×Sd,jd , ji =1, ...,pi, we denote it as g =(j1,j2, ··· ,jd). (3) Citation: Y. Chen and L. Tu, “Density-Based Clustering for Real-Time Stream Data,” in Proceedings of the 13th ACM SIGKDD international conference on Knowledge discovery and data mining, 2007, pp. 133–142.
    See Also:
    Serialized Form
    • Constructor Detail

      • DensityGrid

        public DensityGrid​(int[] c)
        A constructor method for a density grid
        Parameters:
        c - the coordinates of the density grid
      • DensityGrid

        public DensityGrid​(DensityGrid dg)
        A constructor method for a density grid
        Parameters:
        dg - the density grid to copy
    • Method Detail

      • equals

        public boolean equals​(Object o)
        Overrides Object's method equals to declare that two DensityGrids are equal iff their dimensions are the same and each of their corresponding coordinates are the same.
        Overrides:
        equals in class Object
        Parameters:
        o - the object being compared for equality
        Returns:
        TRUE if the objects being compared are equal; FALSE otherwise
      • hashCode

        public int hashCode()
        Overrides Object's method hashCode to generate a hashCode for DensityGrids based on their coordinates.
        Overrides:
        hashCode in class Object
        Returns:
        hc the Object's hash code
      • getNeighbours

        public ArrayList<DensityGrid> getNeighbours()
        Generates an Array List of neighbours for this density grid by varying each coordinate by one in either direction. Does not test whether the generated neighbours are valid as DensityGrid is not aware of the number of partitions in each dimension.
        Returns:
        an Array List of neighbours for this density grid
      • getCoordinates

        public int[] getCoordinates()
        Returns:
        coordinates the coordinates of the density grid
      • getDimensions

        public int getDimensions()
        Returns:
        dimensions the number of dimensions for the density grid
      • getCF

        public CFCluster getCF()
        Returns a reference to the DensityGrid.
        Specified by:
        getCF in class CFCluster
        Returns:
        this density grid.
      • getInclusionProbability

        public double getInclusionProbability​(Instance instance)
        Provides the probability of the argument instance belonging to the density grid in question.
        Specified by:
        getInclusionProbability in class CFCluster
        Returns:
        1.0 if the instance equals the density grid's coordinates; 0.0 otherwise.
      • getRadius

        public double getRadius()
        Provides the radius of a density grid.
        Specified by:
        getRadius in class CFCluster
        Returns:
        1.0, approximating a unit hypercube of dimension d.
      • isVisited

        public boolean isVisited()
        Returns:
        the isVisited
      • setVisited

        public void setVisited​(boolean isVisited)
        Parameters:
        isVisited - the isVisited to set