Package moa.clusterers.dstream
Class DensityGrid
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.cluster.Cluster
-
- moa.cluster.SphereCluster
-
- moa.cluster.CFCluster
-
- moa.clusterers.dstream.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
-
-
Field Summary
-
Fields inherited from class moa.cluster.CFCluster
LS, N, radiusFactor, SS
-
-
Constructor Summary
Constructors Constructor Description DensityGrid(int[] c)
A constructor method for a density gridDensityGrid(DensityGrid dg)
A constructor method for a density grid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.CFCluster
getCF()
Returns a reference to the DensityGrid.int[]
getCoordinates()
int
getDimensions()
double
getInclusionProbability(Instance instance)
Provides the probability of the argument instance belonging to the density grid in question.ArrayList<DensityGrid>
getNeighbours()
Generates an Array List of neighbours for this density grid by varying each coordinate by one in either direction.double
getRadius()
Provides the radius of a density grid.int
hashCode()
Overrides Object's method hashCode to generate a hashCode for DensityGrids based on their coordinates.boolean
isVisited()
void
setVisited(boolean isVisited)
String
toString()
Returns a description of the object.-
Methods inherited from class moa.cluster.CFCluster
add, addVectors, getCenter, getN, getWeight, setN
-
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
getDescription, getGroundTruth, getId, getInfo, getMeasureValue, isGroundTruth, setGroundTruth, setId, setMeasureValue, setMeasureValue
-
Methods inherited from class moa.AbstractMOAObject
copy, copy, measureByteSize, measureByteSize
-
-
-
-
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.
-
hashCode
public int hashCode()
Overrides Object's method hashCode to generate a hashCode for DensityGrids based on their coordinates.
-
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
-
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
-
getCF
public CFCluster getCF()
Returns a reference to the DensityGrid.
-
getInclusionProbability
public double getInclusionProbability(Instance instance)
Provides the probability of the argument instance belonging to the density grid in question.- Specified by:
getInclusionProbability
in classCFCluster
- 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.
-
isVisited
public boolean isVisited()
- Returns:
- the isVisited
-
setVisited
public void setVisited(boolean isVisited)
- Parameters:
isVisited
- the isVisited to set
-
-