Class FlexibleLOF<O>
- java.lang.Object
-
- elki.outlier.lof.FlexibleLOF<O>
-
- Type Parameters:
O
- the type of objects handled by this algorithm
- All Implemented Interfaces:
Algorithm
,OutlierAlgorithm
- Direct Known Subclasses:
OnlineLOF
@Title("FlexibleLOF: Local Outlier Factor with additional options") @Description("Algorithm to compute density-based local outlier factors in a database based on the neighborhood size parameter \'k\'") @Reference(authors="Markus M. Breunig, Hans-Peter Kriegel, Raymond Ng, J\u00f6rg Sander", title="LOF: Identifying Density-Based Local Outliers", booktitle="Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD\'00)", url="https://doi.org/10.1145/342009.335388", bibkey="DBLP:conf/sigmod/BreunigKNS00") public class FlexibleLOF<O> extends java.lang.Object implements OutlierAlgorithm
Flexible variant of the "Local Outlier Factor" algorithm.This implementation diverts from the original LOF publication in that it allows the user to use a different distance function for the reachability distance and neighborhood determination (although the default is to use the same value.)
The k nearest neighbors are determined using the standard distance function, while the reference set used in reachability distance computation is configured using a separate reachability distance function.
The original LOF parameter was called "minPts". For consistency with the name "kNN query", we chose to rename the parameter to
k
. Flexible LOF allows you to set the two values different, which yields the parameters-lof.krefer
and-lof.kreach
.Reference:
Markus M. Breunig, Hans-Peter Kriegel, Raymond Ng, Jörg Sander
LOF: Identifying Density-Based Local Outliers
Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD'00)- Since:
- 0.2
- Author:
- Peer Kröger, Erich Schubert, Elke Achtert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FlexibleLOF.LOFResult<O>
Encapsulates information like the neighborhood, the LRD and LOF values of the objects during a run of theFlexibleLOF
algorithm.static class
FlexibleLOF.Par<O>
Parameterization class.-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected int
kreach
Number of neighbors used for reachability distance.protected int
krefer
Number of neighbors in comparison set.private static Logging
LOG
The logger for this class.protected Distance<? super O>
reachabilityDistance
Reachability distance function.protected Distance<? super O>
referenceDistance
Neighborhood distance function.
-
Constructor Summary
Constructors Constructor Description FlexibleLOF(int krefer, int kreach, Distance<? super O> neighborhoodDistance, Distance<? super O> reachabilityDistance)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
computeLOFs(KNNSearcher<DBIDRef> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax)
Computes the Local outlier factor (LOF) of the specified objects.protected void
computeLRDs(KNNSearcher<DBIDRef> knnq, DBIDs ids, WritableDoubleDataStore lrds)
Computes the local reachability density (LRD) of the specified objects.protected FlexibleLOF.LOFResult<O>
doRunInTime(DBIDs ids, KNNSearcher<DBIDRef> kNNRefer, KNNSearcher<DBIDRef> kNNReach, StepProgress stepprog)
Performs the Generalized LOF_SCORE algorithm on the given database and returns aFlexibleLOF.LOFResult
encapsulating information that may be needed by an OnlineLOF algorithm.TypeInformation[]
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.OutlierResult
run(Relation<O> relation)
Performs the Generalized LOF algorithm on the given database by callingdoRunInTime(elki.database.ids.DBIDs, elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef>, elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef>, elki.logging.progress.StepProgress)
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.outlier.OutlierAlgorithm
autorun
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
krefer
protected int krefer
Number of neighbors in comparison set.
-
kreach
protected int kreach
Number of neighbors used for reachability distance.
-
-
Constructor Detail
-
FlexibleLOF
public FlexibleLOF(int krefer, int kreach, Distance<? super O> neighborhoodDistance, Distance<? super O> reachabilityDistance)
Constructor.- Parameters:
krefer
- The number of neighbors for referencekreach
- The number of neighbors for reachability distanceneighborhoodDistance
- the neighborhood distance functionreachabilityDistance
- the reachability distance function
-
-
Method Detail
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:Algorithm
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in interfaceAlgorithm
- Returns:
- Type restriction
-
run
public OutlierResult run(Relation<O> relation)
Performs the Generalized LOF algorithm on the given database by callingdoRunInTime(elki.database.ids.DBIDs, elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef>, elki.database.query.knn.KNNSearcher<elki.database.ids.DBIDRef>, elki.logging.progress.StepProgress)
.- Parameters:
relation
- Data to process- Returns:
- LOF outlier result
-
doRunInTime
protected FlexibleLOF.LOFResult<O> doRunInTime(DBIDs ids, KNNSearcher<DBIDRef> kNNRefer, KNNSearcher<DBIDRef> kNNReach, StepProgress stepprog)
Performs the Generalized LOF_SCORE algorithm on the given database and returns aFlexibleLOF.LOFResult
encapsulating information that may be needed by an OnlineLOF algorithm.- Parameters:
ids
- Object idskNNRefer
- the kNN query w.r.t. reference neighborhood distance functionkNNReach
- the kNN query w.r.t. reachability distance functionstepprog
- Progress logger- Returns:
- LOF result
-
computeLRDs
protected void computeLRDs(KNNSearcher<DBIDRef> knnq, DBIDs ids, WritableDoubleDataStore lrds)
Computes the local reachability density (LRD) of the specified objects.- Parameters:
knnq
- the precomputed neighborhood of the objects w.r.t. the reachability distanceids
- the ids of the objectslrds
- Reachability storage
-
computeLOFs
protected void computeLOFs(KNNSearcher<DBIDRef> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax)
Computes the Local outlier factor (LOF) of the specified objects.- Parameters:
knnq
- the precomputed neighborhood of the objects w.r.t. the reference distanceids
- IDs to processlrds
- Local reachability distanceslofs
- Local outlier factor storagelofminmax
- Score minimum/maximum tracker
-
-