Package moa.clusterers.dstream
Class GridCluster
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.cluster.Cluster
-
- moa.cluster.SphereCluster
-
- moa.cluster.CFCluster
-
- moa.clusterers.macro.NonConvexCluster
-
- moa.clusterers.dstream.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
-
-
Field Summary
-
Fields inherited from class moa.cluster.CFCluster
LS, N, radiusFactor, SS
-
-
Constructor Summary
Constructors Constructor Description GridCluster(CFCluster cluster, List<CFCluster> microclusters, int label)
GridCluster(CFCluster cluster, List<CFCluster> microclusters, HashMap<DensityGrid,Boolean> hashMap, int label)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
absorbCluster(GridCluster gridClus)
void
addGrid(DensityGrid dg)
int
getClusterLabel()
void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.HashMap<DensityGrid,Boolean>
getGrids()
double
getInclusionProbability(Instance instance)
Iterates through the DensityGrids in the cluster and calculates the inclusion probability for each.double
getWeight()
See interfaceCluster
boolean
isConnected()
Tests a grid cluster for connectedness according to Definition 3.4, Grid Group, from Chen and Tu 2007.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.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.void
removeGrid(DensityGrid dg)
void
setClusterLabel(int clusterLabel)
String
toString()
Returns a description of the object.-
Methods inherited from class moa.clusterers.macro.NonConvexCluster
getCF, getClustering, getMicroClusters, getRadius, insert, remove
-
Methods inherited from class moa.cluster.SphereCluster
combine, getCenterDistance, getCenterDistance, getClusterSpecificInfo, getDistanceVector, getDistanceVector, getHullDistance, merge, overlapRadiusDegree, overlapSave, sample, setCenter, setRadius, setWeight
-
Methods inherited from class moa.cluster.Cluster
getGroundTruth, getId, getInfo, getMeasureValue, isGroundTruth, setGroundTruth, setId, setMeasureValue, setMeasureValue
-
Methods inherited from class moa.AbstractMOAObject
copy, copy, measureByteSize, measureByteSize
-
-
-
-
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 outsidedgH
- 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
-
getGrids
public HashMap<DensityGrid,Boolean> getGrids()
-
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 inAbstractMOAObject.toString
to give a string representation of the object.- Specified by:
getDescription
in interfaceMOAObject
- Overrides:
getDescription
in classCluster
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
getWeight
public double getWeight()
Description copied from class:CFCluster
See interfaceCluster
- Overrides:
getWeight
in classCFCluster
- Returns:
- the number of density grids in the cluster
- See Also:
Cluster.getWeight()
-
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 classNonConvexCluster
- Returns:
- 1.0 if instance matches any of the density grids; 0.0 otherwise.
-
toString
public String toString()
Description copied from class:AbstractMOAObject
Returns a description of the object.- Overrides:
toString
in classAbstractMOAObject
- Returns:
- a String listing each coordinate of the density grid
-
-