O
- the type of DatabaseObjects handled by this Algorithm@Title(value="LOF: Local Outlier Factor") @Description(value="Algorithm to compute density-based local outlier factors in a database based on the neighborhood size parameter \'k\'") @Reference(authors="M. M. Breunig, H.-P. Kriegel, R. Ng, J. Sander", title="LOF: Identifying Density-Based Local Outliers", booktitle="Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD \'00), Dallas, TX, 2000", url="http://dx.doi.org/10.1145/342009.335388") public class FlexibleLOF<O> extends AbstractAlgorithm<OutlierResult> 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 parameter
DistanceBasedAlgorithm.DISTANCE_FUNCTION_ID
, while the reference set used in reachability distance computation is
configured using FlexibleLOF.Parameterizer.REACHABILITY_DISTANCE_FUNCTION_ID
.
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 FlexibleLOF.Parameterizer.KREF_ID
(-lof.krefer
) and
FlexibleLOF.Parameterizer.KREACH_ID
(-lof.kreach
)
Reference:
M. M. Breunig, H.-P. Kriegel, R. Ng, J. Sander: LOF: Identifying
Density-Based Local Outliers.
In: Proc. 2nd ACM SIGMOD Int. Conf. on Management of Data (SIGMOD'00),
Dallas, TX, 2000.
Modifier and Type | Class and Description |
---|---|
static class |
FlexibleLOF.LOFResult<O>
Encapsulates information like the neighborhood, the LRD and LOF values of
the objects during a run of the
FlexibleLOF algorithm. |
static class |
FlexibleLOF.Parameterizer<O>
Parameterization class.
|
Modifier and Type | Field and 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 DistanceFunction<? super O> |
reachabilityDistanceFunction
Reachability distance function.
|
protected DistanceFunction<? super O> |
referenceDistanceFunction
Neighborhood distance function.
|
Constructor and Description |
---|
FlexibleLOF(int krefer,
int kreach,
DistanceFunction<? super O> neighborhoodDistanceFunction,
DistanceFunction<? super O> reachabilityDistanceFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeLOFs(KNNQuery<O> knnq,
DBIDs ids,
DoubleDataStore lrds,
WritableDoubleDataStore lofs,
DoubleMinMax lofminmax)
Computes the Local outlier factor (LOF) of the specified objects.
|
protected void |
computeLRDs(KNNQuery<O> knnq,
DBIDs ids,
WritableDoubleDataStore lrds)
Computes the local reachability density (LRD) of the specified objects.
|
protected FlexibleLOF.LOFResult<O> |
doRunInTime(DBIDs ids,
KNNQuery<O> kNNRefer,
KNNQuery<O> kNNReach,
StepProgress stepprog)
Performs the Generalized LOF_SCORE algorithm on the given database and
returns a
FlexibleLOF.LOFResult encapsulating information that may
be needed by an OnlineLOF algorithm. |
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
private Pair<KNNQuery<O>,KNNQuery<O>> |
getKNNQueries(Database database,
Relation<O> relation,
StepProgress stepprog)
Get the kNN queries for the algorithm.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
OutlierResult |
run(Database database,
Relation<O> relation)
Performs the Generalized LOF algorithm on the given database by calling
doRunInTime(de.lmu.ifi.dbs.elki.database.ids.DBIDs, de.lmu.ifi.dbs.elki.database.query.knn.KNNQuery<O>, de.lmu.ifi.dbs.elki.database.query.knn.KNNQuery<O>, de.lmu.ifi.dbs.elki.logging.progress.StepProgress) . |
makeParameterDistanceFunction, run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
private static final Logging LOG
protected int krefer
protected int kreach
protected DistanceFunction<? super O> referenceDistanceFunction
protected DistanceFunction<? super O> reachabilityDistanceFunction
public FlexibleLOF(int krefer, int kreach, DistanceFunction<? super O> neighborhoodDistanceFunction, DistanceFunction<? super O> reachabilityDistanceFunction)
krefer
- The number of neighbors for referencekreach
- The number of neighbors for reachability distanceneighborhoodDistanceFunction
- the neighborhood distance functionreachabilityDistanceFunction
- the reachability distance functionpublic OutlierResult run(Database database, Relation<O> relation)
doRunInTime(de.lmu.ifi.dbs.elki.database.ids.DBIDs, de.lmu.ifi.dbs.elki.database.query.knn.KNNQuery<O>, de.lmu.ifi.dbs.elki.database.query.knn.KNNQuery<O>, de.lmu.ifi.dbs.elki.logging.progress.StepProgress)
.database
- Database to queryrelation
- Data to processprivate Pair<KNNQuery<O>,KNNQuery<O>> getKNNQueries(Database database, Relation<O> relation, StepProgress stepprog)
relation
- the datastepprog
- the progress loggerprotected FlexibleLOF.LOFResult<O> doRunInTime(DBIDs ids, KNNQuery<O> kNNRefer, KNNQuery<O> kNNReach, StepProgress stepprog)
FlexibleLOF.LOFResult
encapsulating information that may
be needed by an OnlineLOF algorithm.ids
- Object idskNNRefer
- the kNN query w.r.t. reference neighborhood distance
functionkNNReach
- the kNN query w.r.t. reachability distance functionstepprog
- Progress loggerprotected void computeLRDs(KNNQuery<O> knnq, DBIDs ids, WritableDoubleDataStore lrds)
knnq
- the precomputed neighborhood of the objects w.r.t. the
reachability distanceids
- the ids of the objectslrds
- Reachability storageprotected void computeLOFs(KNNQuery<O> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax)
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 trackerpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<OutlierResult>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<OutlierResult>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.