de.lmu.ifi.dbs.elki.algorithm.outlier
Class OnlineLOF.LOFKNNListener

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.algorithm.outlier.OnlineLOF.LOFKNNListener
All Implemented Interfaces:
KNNListener, EventListener
Enclosing class:
OnlineLOF<O,D extends NumberDistance<D,?>>

private class OnlineLOF.LOFKNNListener
extends Object
implements KNNListener

Encapsulates a listener for changes of kNNs used in the online LOF algorithm.


Field Summary
private  KNNChangeEvent firstEventReceived
          Holds the first event of one of the both preprocessors.
private  LOF.LOFResult<O,D> lofResult
          Holds the result of a former run of the LOF algorithm.
 
Constructor Summary
OnlineLOF.LOFKNNListener(LOF.LOFResult<O,D> lofResult)
          Constructs a listener for the LOF algorithm.
 
Method Summary
 void kNNsChanged(KNNChangeEvent e)
          Invoked after kNNs have been updated, inserted or removed in some way.
private  void kNNsChanged(KNNChangeEvent e1, KNNChangeEvent e2)
          Invoked after the events of both preprocessors have been received, i.e.
private  void kNNsInserted(DBIDs insertions, DBIDs updates1, DBIDs updates2, LOF.LOFResult<O,D> lofResult)
          Invoked after kNNs have been inserted and updated, updates the result.
private  void kNNsRemoved(DBIDs deletions, DBIDs updates1, DBIDs updates2, LOF.LOFResult<O,D> lofResult)
          Invoked after kNNs have been removed and updated, updates the result.
private  ArrayModifiableDBIDs mergeIDs(List<List<DistanceResultPair<D>>> queryResults, DBIDs... ids)
          Merges the ids of the query result with the specified ids.
private  void recomputeLOFs(DBIDs ids, LOF.LOFResult<O,D> lofResult)
          Recomputes the lofs of the specified ids.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firstEventReceived

private KNNChangeEvent firstEventReceived
Holds the first event of one of the both preprocessors. The online algorithm is waiting until both events have been received, i.e. until both preprocessors are up to date.


lofResult

private LOF.LOFResult<O,D extends NumberDistance<D,?>> lofResult
Holds the result of a former run of the LOF algorithm.

Constructor Detail

OnlineLOF.LOFKNNListener

public OnlineLOF.LOFKNNListener(LOF.LOFResult<O,D> lofResult)
Constructs a listener for the LOF algorithm.

Parameters:
lofResult - the result of a former run of the LOF algorithm
Method Detail

kNNsChanged

public void kNNsChanged(KNNChangeEvent e)
Description copied from interface: KNNListener
Invoked after kNNs have been updated, inserted or removed in some way.

Specified by:
kNNsChanged in interface KNNListener
Parameters:
e - the change event

kNNsChanged

private void kNNsChanged(KNNChangeEvent e1,
                         KNNChangeEvent e2)
Invoked after the events of both preprocessors have been received, i.e. until both preprocessors are up to date.

Parameters:
e1 - the change event of the first preprocessor
e2 - the change event of the second preprocessor

kNNsInserted

private void kNNsInserted(DBIDs insertions,
                          DBIDs updates1,
                          DBIDs updates2,
                          LOF.LOFResult<O,D> lofResult)
Invoked after kNNs have been inserted and updated, updates the result.

Parameters:
insertions - the ids of the newly inserted neighborhoods
updates1 - the ids of the updated neighborhood w.r.t. the neighborhood distance function
updates2 - the ids of the updated neighborhood w.r.t. the reachability distance function
lofResult - the result of the former LOF run

kNNsRemoved

private void kNNsRemoved(DBIDs deletions,
                         DBIDs updates1,
                         DBIDs updates2,
                         LOF.LOFResult<O,D> lofResult)
Invoked after kNNs have been removed and updated, updates the result.

Parameters:
deletions - the ids of the removed neighborhoods
updates1 - the ids of the updated neighborhood w.r.t. the neighborhood distance function
updates2 - the ids of the updated neighborhood w.r.t. the reachability distance function
lofResult - the result of the former LOF run

mergeIDs

private ArrayModifiableDBIDs mergeIDs(List<List<DistanceResultPair<D>>> queryResults,
                                      DBIDs... ids)
Merges the ids of the query result with the specified ids.

Parameters:
queryResults - the list of query results
ids - the list of ids
Returns:
a set containing the ids of the query result and the specified ids

recomputeLOFs

private void recomputeLOFs(DBIDs ids,
                           LOF.LOFResult<O,D> lofResult)
Recomputes the lofs of the specified ids.

Parameters:
ids - the ids of the lofs to be recomputed
lofResult - the result of the former LOF run

Release 0.4.0 (2011-09-20_1324)