Package moa.clusterers.dstream
Class CharacteristicVector
- java.lang.Object
-
- moa.clusterers.dstream.CharacteristicVector
-
public class CharacteristicVector extends Object
The Characteristic Vector of a density grid is defined in Definition 3.2 of Chen and Tu 2007 as: The characteristic vector of a grid g is a tuple (tg,tm,D, label,status), where tg is the last time when g is updated, tm is the last time when g is removed from grid list as a sporadic grid (if ever), D is the grid density at the last update, label is the class label of the grid, and status = {SPORADIC, NORMAL} is a label used for removing sporadic grids. 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.
-
-
Constructor Summary
Constructors Constructor Description CharacteristicVector(int tg, int tm, double D, int label, boolean status, double dl, double dm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
densityWithNew(int currTime, double decayFactor)
Implements the density update function given in eq 5 (Proposition 3.1) of Chen and Tu 2007.int
getAttribute()
double
getCurrGridDensity(int currTime, double decayFactor)
int
getDensityTimeStamp()
double
getGridDensity()
int
getLabel()
int
getRemoveTime()
int
getUpdateTime()
boolean
isAttChanged()
boolean
isDense(double dm)
Implements the test for whether a density grid is dense given in eq 8 of Chen and Tu 2007.boolean
isSparse(double dl)
Implements the test for whether a density grid is sparse given in eq 9 of Chen and Tu 2007.boolean
isSporadic()
boolean
isTransitional(double dm, double dl)
Implements the test for whether a density grid is transitional given in eq 10 of Chen and Tu 2007.void
setDensityTimeStamp(int densityTimeStamp)
void
setGridDensity(double gridDensity, int timeStamp)
void
setLabel(int newLabel)
void
setRemoveTime(int removeTime)
void
setSporadic(boolean isSporadic)
void
setUpdateTime(int updateTime)
String
toString()
Overrides Object's toString method.void
updateGridDensity(int currTime, double decayFactor, double dl, double dm)
Implements the update the density of all grids step given at line 2 of both Fig 3 and Fig 4 of Chen and Tu 2007.
-
-
-
Constructor Detail
-
CharacteristicVector
public CharacteristicVector(int tg, int tm, double D, int label, boolean status, double dl, double dm)
- Parameters:
tg
- - the last time when g is updatedtm
- - the last time when g is removed from grid_listD
- - the grid density at the last updatelabel
- - the class label of the gridstatus
- - SPORADIC (true) or NORMAL (false)
-
-
Method Detail
-
getUpdateTime
public int getUpdateTime()
- Returns:
- the time at which the grid was last updated
-
setUpdateTime
public void setUpdateTime(int updateTime)
- Parameters:
updateTime
- the time at which the grid was updated
-
getRemoveTime
public int getRemoveTime()
- Returns:
- the last time at which the grid was removed from grid_list
-
setRemoveTime
public void setRemoveTime(int removeTime)
- Parameters:
removeTime
- the time at which the grid was removed from grid_list
-
getGridDensity
public double getGridDensity()
- Returns:
- the density of the grid
-
getCurrGridDensity
public double getCurrGridDensity(int currTime, double decayFactor)
- Parameters:
currTime
- - the current time to calculate the density fordecayFactor
- - the decay factor, lambda, of the algorithm- Returns:
- the density of the grid at the current time
-
setGridDensity
public void setGridDensity(double gridDensity, int timeStamp)
- Parameters:
gridDensity
- the density of the gridtimeStamp
- the time at which the gridDensity is being updated
-
getLabel
public int getLabel()
- Returns:
- the label of the cluster to which the grid is assigned
-
setLabel
public void setLabel(int newLabel)
- Parameters:
newLabel
- the label of the cluster to assign the grid to
-
isSporadic
public boolean isSporadic()
- Returns:
- TRUE if the characteristic vector is sporadic, FALSE otherwise
-
setSporadic
public void setSporadic(boolean isSporadic)
- Parameters:
isSporadic
- TRUE if the characteristic vector is to be labelled as sporadic, FALSE otherwise
-
getDensityTimeStamp
public int getDensityTimeStamp()
-
setDensityTimeStamp
public void setDensityTimeStamp(int densityTimeStamp)
-
densityWithNew
public void densityWithNew(int currTime, double decayFactor)
Implements the density update function given in eq 5 (Proposition 3.1) of Chen and Tu 2007.- Parameters:
currTime
- the data stream's current internal timedecayFactor
- the value of lambda
-
updateGridDensity
public void updateGridDensity(int currTime, double decayFactor, double dl, double dm)
Implements the update the density of all grids step given at line 2 of both Fig 3 and Fig 4 of Chen and Tu 2007.- Parameters:
currTime
- the data stream's current internal timedecayFactor
- the value of lambdadl
- the threshold for sparse gridsdm
- the threshold for dense grids
-
isDense
public boolean isDense(double dm)
Implements the test for whether a density grid is dense given in eq 8 of Chen and Tu 2007.- Parameters:
dm
- the threshold for dense grids
-
isSparse
public boolean isSparse(double dl)
Implements the test for whether a density grid is sparse given in eq 9 of Chen and Tu 2007.- Parameters:
dl
- the threshold for sparse grids
-
isTransitional
public boolean isTransitional(double dm, double dl)
Implements the test for whether a density grid is transitional given in eq 10 of Chen and Tu 2007.- Parameters:
dm
- the threshold for dense gridsdl
- the threshold for sparse grids
-
getAttribute
public int getAttribute()
- Returns:
- the characteristic vector's attribute {SPARSE, TRANSITIONAL, DENSE}
-
isAttChanged
public boolean isAttChanged()
- Returns:
- true if the characteristic vector's attribute changed during the last density update, false otherwise.
-
-