O - the type of objects handled by this algorithm@Title(value="FlexibleLOF: Local Outlier Factor with additional options") @Description(value="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 AbstractAlgorithm<OutlierResult> implements OutlierAlgorithm
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)
| 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.
|
ALGORITHM_ID| 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). |
runclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrunprivate 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()
AbstractAlgorithmgetInputTypeRestriction in interface AlgorithmgetInputTypeRestriction in class AbstractAlgorithm<OutlierResult>protected Logging getLogger()
AbstractAlgorithmgetLogger in class AbstractAlgorithm<OutlierResult>Copyright © 2019 ELKI Development Team. License information.