Class GridCluster

  • All Implemented Interfaces:
    Serializable, IDenseMacroCluster, MOAObject

    public class GridCluster
    extends NonConvexCluster
    Grid Clusters are defined in Definition 3.6 of Chen and Tu 2007 as: Let G =(g1, ·· · ,gm) be a grid group, if every inside grid of G is a dense grid and every outside grid is either a dense grid or a transitional grid, then G is a grid cluster. 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
    • Method Detail

      • addGrid

        public void addGrid​(DensityGrid dg)
        Parameters:
        dg - the density grid to add to the cluster
      • removeGrid

        public void removeGrid​(DensityGrid dg)
        Parameters:
        dg - the density grid to remove from the cluster
      • absorbCluster

        public void absorbCluster​(GridCluster gridClus)
        Parameters:
        gridClus - the GridCluster to be absorbed into this cluster
      • isInside

        public Boolean isInside​(DensityGrid dg)
        Inside Grids are defined in Definition 3.5 of Chen and Tu 2007 as: Consider a grid group G and a grid g ∈ G, suppose g =(j1, ··· ,jd), if g has neighboring grids in every dimension i =1, ·· · ,d, then g is an inside grid in G.Otherwise g is an outside grid in G.
        Parameters:
        dg - the density grid to label as being inside or out
        Returns:
        TRUE if g is an inside grid, FALSE otherwise
      • isInside

        public Boolean isInside​(DensityGrid dg,
                                DensityGrid dgH)
        Inside Grids are defined in Definition 3.5 of Chen and Tu 2007 as: Consider a grid group G and a grid g ∈ G, suppose g =(j1, ··· ,jd), if g has neighboring grids in every dimension i =1, ·· · ,d, then g is an inside grid in G. Otherwise g is an outside grid in G.
        Parameters:
        dg - the density grid being labelled as inside or outside
        dgH - the density grid being proposed for addition
        Returns:
        TRUE if g would be an inside grid, FALSE otherwise
      • getClusterLabel

        public int getClusterLabel()
        Returns:
        the class label assigned to the cluster
      • setClusterLabel

        public void setClusterLabel​(int clusterLabel)
        Parameters:
        clusterLabel - the class label to assign to the cluster
      • getDescription

        public void getDescription​(StringBuilder sb,
                                   int indent)
        Description copied from interface: MOAObject
        Returns a string representation of this object. Used in AbstractMOAObject.toString to give a string representation of the object.
        Specified by:
        getDescription in interface MOAObject
        Overrides:
        getDescription in class Cluster
        Parameters:
        sb - the stringbuilder to add the description
        indent - the number of characters to indent
      • isConnected

        public boolean isConnected()
        Tests a grid cluster for connectedness according to Definition 3.4, Grid Group, from Chen and Tu 2007. Selects one density grid in the grid cluster as a starting point and iterates repeatedly through its neighbours until no more density grids in the grid cluster can be visited.
        Returns:
        TRUE if the cluster represent one single grid group; FALSE otherwise.
      • getInclusionProbability

        public double getInclusionProbability​(Instance instance)
        Iterates through the DensityGrids in the cluster and calculates the inclusion probability for each.
        Overrides:
        getInclusionProbability in class NonConvexCluster
        Returns:
        1.0 if instance matches any of the density grids; 0.0 otherwise.