Package elki.outlier.lof
Class OnlineLOF.LOFKNNListener
- java.lang.Object
-
- elki.outlier.lof.OnlineLOF.LOFKNNListener
-
- All Implemented Interfaces:
KNNListener
,java.util.EventListener
private class OnlineLOF.LOFKNNListener extends java.lang.Object implements KNNListener
Encapsulates a listener for changes of kNNs used in the online LOF algorithm.- Author:
- Elke Achtert
-
-
Field Summary
Fields Modifier and Type Field Description private KNNChangeEvent
firstEventReceived
Holds the first event of one of the both preprocessors.private FlexibleLOF.LOFResult<O>
lofResult
Holds the result of a former run of the LOF algorithm.
-
Constructor Summary
Constructors Constructor Description LOFKNNListener(FlexibleLOF.LOFResult<O> lofResult)
Constructs a listener for the LOF algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, FlexibleLOF.LOFResult<O> lofResult)
Invoked after kNNs have been inserted and updated, updates the result.private void
kNNsRemoved(DBIDs deletions, DBIDs updates1, DBIDs updates2, FlexibleLOF.LOFResult<O> lofResult)
Invoked after kNNs have been removed and updated, updates the result.private void
recomputeLOFs(DBIDs ids, FlexibleLOF.LOFResult<O> lofResult)
Recomputes the lofs of the specified ids.
-
-
-
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 FlexibleLOF.LOFResult<O> lofResult
Holds the result of a former run of the LOF algorithm.
-
-
Constructor Detail
-
LOFKNNListener
public LOFKNNListener(FlexibleLOF.LOFResult<O> 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 interfaceKNNListener
- 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 preprocessore2
- the change event of the second preprocessor
-
kNNsInserted
private void kNNsInserted(DBIDs insertions, DBIDs updates1, DBIDs updates2, FlexibleLOF.LOFResult<O> lofResult)
Invoked after kNNs have been inserted and updated, updates the result.- Parameters:
insertions
- the ids of the newly inserted neighborhoodsupdates1
- the ids of the updated neighborhood w.r.t. the neighborhood distance functionupdates2
- the ids of the updated neighborhood w.r.t. the reachability distance functionlofResult
- the result of the former LOF run
-
kNNsRemoved
private void kNNsRemoved(DBIDs deletions, DBIDs updates1, DBIDs updates2, FlexibleLOF.LOFResult<O> lofResult)
Invoked after kNNs have been removed and updated, updates the result.- Parameters:
deletions
- the ids of the removed neighborhoodsupdates1
- the ids of the updated neighborhood w.r.t. the neighborhood distance functionupdates2
- the ids of the updated neighborhood w.r.t. the reachability distance functionlofResult
- the result of the former LOF run
-
recomputeLOFs
private void recomputeLOFs(DBIDs ids, FlexibleLOF.LOFResult<O> lofResult)
Recomputes the lofs of the specified ids.- Parameters:
ids
- the ids of the lofs to be recomputedlofResult
- the result of the former LOF run
-
-